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 has been archived by the owner on Apr 13, 2023. It is now read-only.
Intended behavior: useQuery checks if component is unmounted at the moment when the setState is fired and skips state update on cache update
Actual behavior: When "parent" component and "child" components both listen for same query. And at some point due to the cache update for that listened query "child" should unmount the warning about update of state for unmounted component is fired.
I experience this too. I have been trying to figure out how to get rid of the message and so far, the only thing that worked was to set fetchPolicy: "no-cache", but that slows everything down.
I though that maybe #3139 fixed it, but it only seems to affect subscriptions.
I managed to sort this out by replacing the useQuery hook with the useLazyQuery and calling it from the useEffect.
Hope that will work for you as well.
I managed to sort this out by replacing the useQuery hook with the useLazyQuery and calling it from the useEffect.
Hope that will work for you as well.
yeah I know about this workaround
but it would be better to have a clean way without redundant tricks
Thank you, @jvrbnjak89. It looks like a fix is close to being released, so I will wait for that, but I appreciate the further insight into the issue that you provided!
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Intended behavior:
useQuery
checks if component is unmounted at the moment when thesetState
is fired and skips state update on cache updateActual behavior: When "parent" component and "child" components both listen for same query. And at some point due to the cache update for that listened query "child" should unmount the warning about update of state for unmounted component is fired.
Steps to reporoduce: Codesanbox link
The text was updated successfully, but these errors were encountered: