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!
EDIT: note that I've noted tried the non-suspense mode. I'm _assuming_ this is a suspense only issue.
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 notifications@github.com, 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
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 notifications@github.com, 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!
First of all amazing work on the whole project.
I still stumble upon the same issue with suspense enabled on the latest version.
Is there maybe a hint on why this is happening?
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!
Most helpful comment
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 notifications@github.com, wrote: