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.
When a subscription's initial data is returned by the GraphQL server,
the useSubscription hook should:
Set loading to false.
Provide the data in data.
Do this 100% of the time.
Actual outcome:
Approximately 30% of the time (in my case) the initial data is returned by the GraphQL server but loading remains true and data remains undefined.
How to reproduce the issue:
Based on my investigate I believe this issue will occur in any application which uses useSubscription. However due to its intermittent / race condition nature it will be highly dependent on the complexity of the React application, and network conditions.
I have posted a screen cast here demonstrating the issue here.
Root cause:
As identified in the video, I believe the root cause is a race condition in /packages/hooks/src/data/SubscriptionData.ts which implicitly requires that isMounted will be set to truebeforeupdateResult is called, and this is not always the case.