-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
useSuspenseQuery
does not respond to cache updates when the component unmounts, then remounts
#10478
Comments
@jerelmiller were you able to find out the cause of this? |
@johnknoop unfortunately not quite yet. I've been digging pretty deep on this one, but I still haven't quite figured out the root cause. I was hoping #10601 would have fixed this one as well, but alas, no such luck. I'm hoping I can figure it out soon! |
Writing my findings down as I've discovered a reason the cache isn't properly updated. I still have a bit to figure out why it gets in this state, but this should help in the discovery process. After a mutation is run, we run The question is why Still a bit more digging to determine why its kept in this state. If I were to guess at this point, I'd suspect that when we are able to read from the cache, |
Finished with #10651 |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Issue Description
While working within the Spotify demo, I noticed that
useSuspenseQuery
is not responding to cache updates after the component unmounts. At least this is my suspicion. If I load some data on a page, leave the page, then navigate back to it, I am no longer able to get cache updates. See the reproduction steps for an example of this happening.I was able to confirm that
useQuery
does not have this issue. If I follow the same reproduction steps withuseQuery
, I get cache updates as expected.This appears to only be an issue with the
cache-first
fetch policy.cache-and-network
andnetwork-only
fetch policies receive cache updates as expected.Link to Reproduction
Spotify demo
Reproduction Steps
While using the Spotify demo:
You'll notice that nothing happens. If you inspect the cache with Apollo Dev Tools, the cache is properly updated, however
useSuspenseQuery
is not properly updated with the updated cache data.The text was updated successfully, but these errors were encountered: