Sub and pub not loading, giving worst performance

i am using react component for frontend, i just called my subscription out side the react component(also out side of with tracker) and now the subscription ready is not working sometime and it take too much time to load the data

Can you provide some code context, or possibly even a link to a repository if it’s available?

1 Like

Seems like there might be an infinite loop happening. Can you share your code for the publication and the react component?

1 Like

Unless you are using callbacks in subscribe, if you are calling your subscription outside of tracker, then that explains your problem. What will happen is it will start the subscription on the first render, then sit around until something random causes a re-render. It’ll appear both inconsistent, because sometimes your subscription might be available right away, and sometimes not - or slow, because a rerender won’t happen until an indeterminate amount of time later.

Use tracker or provide a callback.

If you don’t want to use useTracker or withTracker then you’ll need to find another mechanism to update your tree in response to subscription ready, such as redux or similar.


Thank you @captainn :slight_smile: