-
-
Notifications
You must be signed in to change notification settings - Fork 3k
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
suspense mode fetches twice when no prefetching #51
Comments
Yeah I know what’s happening now that you describe it. I’ll have a fix out tomorrow.
Tanner Linsley
…On Nov 24, 2019, 9:13 PM -0700, Thibaut Tiberghien ***@***.***>, wrote:
Hello,
I've been fighting a double fetch issue which I thought came from my custom hook that wraps useQuery. Turns out it seems to come from useQuery itself.
When using the suspense mode, the fetch function is called twice, once on initial render, and once when the data comes in. This only happens if the query was not prefetched. I've forked your codesandbox and disabled prefetching of projects when you click "Show projects", I've also added a log at the start of the fetch function so it's easy to debug in the console.
Have a look here: https://codesandbox.io/s/react-query-double-fetch-q5zgl
Let me know if there is additional details I can provide.
Thanks!
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or unsubscribe.
|
Fixed in 0.3.17 |
1 similar comment
Fixed in 0.3.17 |
Yep, tested and we're all good. Thanks for the quick release :). |
You bet!
Tanner Linsley
…On Nov 25, 2019, 6:49 PM -0700, Thibaut Tiberghien ***@***.***>, wrote:
Yep, tested and we're all good. Thanks for the quick release :).
—
You are receiving this because you modified the open/close state.
Reply to this email directly, view it on GitHub, or unsubscribe.
|
Hello @tannerlinsley! Thank you! EDIT: I downgraded my react-query version to 0.3.17 just to make sure that I'm not missing something and it does not fetch twice indeed |
Raised #342 with a test for this behaviour :) |
@simoncarpinter meant #324? Nice work with the test, a good start :) |
I did, yes, doh! |
Hello,
I've been fighting a double fetch issue which I thought came from my custom hook that wraps
useQuery
. Turns out it seems to come fromuseQuery
itself.When using the suspense mode, the fetch function is called twice, once on initial render, and once when the data comes in. This only happens if the query was not prefetched. I've forked your codesandbox and disabled prefetching of projects when you click "Show projects", I've also added a log at the start of the fetch function so it's easy to debug in the console.
Have a look here: https://codesandbox.io/s/react-query-double-fetch-q5zgl
Let me know if there is additional details I can provide.
Thanks!
EDIT: note that I've noted tried the non-suspense mode. I'm assuming this is a suspense only issue.
The text was updated successfully, but these errors were encountered: