T
TanStack3y ago
genetic-orange

@tanstack/react-query not working with Vite

what I am using:
vite/4.1.4 darwin-arm64 node-v18.3.0,"@supabase/supabase-js": "^2.8.0","@tanstack/react-query": "^4.24.10",
vite/4.1.4 darwin-arm64 node-v18.3.0,"@supabase/supabase-js": "^2.8.0","@tanstack/react-query": "^4.24.10",
. When I am trying to execute a basic query against supabase, using Vite and react-query, useQuery gets stuck in loading state.
No description
14 Replies
absent-sapphire
absent-sapphire3y ago
Does the Supabase function return a promise that resolves/rejects?
genetic-orange
genetic-orangeOP3y ago
I don't know exactly. I use await when fetching data could that mean that it returns a promise?
absent-sapphire
absent-sapphire3y ago
Async functions always return a promise but I'd look at what's happening with the Supabase function. TanStack Query works perfectly fine with Vite
genetic-orange
genetic-orangeOP3y ago
This seems to be related to vite or react-query, i.e. I am either wrapping inside queryclientprovider wrong or it is not available where I use it. I don't know. I replaced supabase request with regular fetch and still the whole thing gets paused
absent-sapphire
absent-sapphire3y ago
Please can you provide a runnable reproduction so we can take a look for you?
genetic-orange
genetic-orangeOP3y ago
I will 5 mins
absent-sapphire
absent-sapphire3y ago
Thanks for supplying a reproduction. This works as expected for me. Does it not work for you?
genetic-orange
genetic-orangeOP3y ago
I don't get any response. In the object returned by useQuery I see that isPaused is true and this is happening all the time request is being paused so do you see the whole response object rendered on the screen?
absent-sapphire
absent-sapphire3y ago
Yeah, I do If it's paused I wonder if it's an issue with the network on which you're running in?
genetic-orange
genetic-orangeOP3y ago
ow wow I just noticed that on firefox everything works fine. It is chrome doing some weird stuff thank you Louis, if it were not for you I would spend another 5 days searching for the cause
absent-sapphire
absent-sapphire3y ago
Awesome, no worries :reactquery:
itchy-amethyst
itchy-amethyst3y ago
There's some version of chrome where navigator.onLine has a bug :/ upgrading chrome should hopefully solve it
adverse-sapphire
adverse-sapphire3y ago
My Chrome is up-to-date and I think I ran into this same issue. Safari works fine, Firefox works fine. @bkyerv FWIW, I had to reinstall Chrome and it was all working fine again. First time I ever had to reinstall a browser xD

Did you find this page helpful?