Skip to content
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's refetch keeps suspending when variables not changed #11085

Closed
izumin5210 opened this issue Jul 20, 2023 · 6 comments · Fixed by #11086
Closed

useSuspenseQuery's refetch keeps suspending when variables not changed #11085

izumin5210 opened this issue Jul 20, 2023 · 6 comments · Fixed by #11086

Comments

@izumin5210
Copy link
Contributor

izumin5210 commented Jul 20, 2023

Issue Description

When useSuspenseQuery's refetch is executed, Suspense fallback is still drawn and does not move forward

Link to Reproduction

https://codesandbox.io/s/apollo-client-v18-use-suspense-query-bug-yg6rzy?file=/src/App.tsx

Reproduction Steps

No response

@izumin5210
Copy link
Contributor Author

In the following reproduced code, the process continues correctly when the query result changes.
https://codesandbox.io/s/cranky-gould-6npmlm?file=/src/index.jsx

It seems that the Promise is not resolved correctly when there is no change in the Apollo Cache.

@jerelmiller
Copy link
Member

jerelmiller commented Jul 20, 2023

Hey @izumin5210 👋

I'm pretty sure I broke this in #11035 for the final beta release while trying to fix a separate issue (incrementally re-rendering queries with @defer in a refetch). Using your reproduction, I can see that 3.8.0-beta.6 works correctly, but 3.8.0-beta.7 is where the bug is introduced.

I will make sure to get a fix in for the next rc release. Thanks so much for bringing this to our attention!!

@jerelmiller jerelmiller self-assigned this Jul 20, 2023
@izumin5210
Copy link
Contributor Author

Thanks for the quick reply! Looking forward to your next release!

@jerelmiller
Copy link
Member

@izumin5210 I've got #11086 up that fixes this issue. I've created a snapshot release that you can try out if you'd like to see this in your own app.

npm i @apollo/client@0.0.0-pr-11086-20230721035547

I've confirmed this snapshot release fixes the issue demonstrated in your reproduction: https://codesandbox.io/s/apollo-client-v18-use-suspense-query-bug-forked-cqstj9

@jerelmiller
Copy link
Member

Fixed with #11086. This will go out with the next rc release.

@github-actions
Copy link
Contributor

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.
For general questions, we recommend using StackOverflow or our discord server.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 24, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
3 participants