-
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
skip: true and skipToken behave differently with useSuspenseQuery #12059
Comments
This is such an interesting one. Both apollo-client/src/react/hooks/useSuspenseQuery.ts Lines 357 to 382 in 1f0333e
Other than this, both of these code paths rely on checking
I'll have to dig into this further to understand where the difference is, but unfortunately won't have time to do so for a couple days. Thanks for raising the issue! |
Not sure but I think the
@jerelmiller I can put a PR if it makes sense. Although I see in the docs that |
@naman1608 you're welcome to try a fix! I think moving the check for We are preparing for our upcoming 3.12 release, so if you end up getting a fix in place, we'll look at adding that to a 3.12 patch release. No obligation though! |
Issue Description
I'm pretty sure this is a bug with
skip: true
, or at leastskipToken
behaves like I'd expect.If you have a
useSuspenseQuery
that usesskip: boolean
and toggles between true and false for that, it seems like sometimes the switch from true to false causes the query to skip the cache and suspend.In the demo, you can quickly hit the button to toggle skipping on or off. Every once in a while, you can see the top one (skip: boolean) pop a suspend for a few frames, while the bottom one (skipToken) correctly re-reads from the cache.
Link to Reproduction
https://codesandbox.io/p/sandbox/lz67k5?file=%2Fsrc%2FApp.tsx%3A34%2C67
Reproduction Steps
No response
@apollo/client
version3.11.8
The text was updated successfully, but these errors were encountered: