You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Apr 13, 2023. It is now read-only.
I am using useSubscription in one of my components. I do not use any of the return values, because I am using a complicated protocol in my subscription, and I do not want to act on every message I receive. Instead, I am using the onSubscriptionData callback function. I was surprised to see that even though I only update state on some of the received messages, my component is rerendering continuously. It seems that using useSubscription will trigger a re-render every time subscription data is received, even if it is discarded.
It would be very useful to have a version of useSubscription that does not trigger a re-render whenever data is received, and instead let the user decide when to make state changes in onSubscriptionData. For now, I have had to put my subscription in a sub-component, just to make the superfluous re-rendering computationally cheaper.