T
TanStack4y ago
adverse-sapphire

RN(Expo) Paused mutations runs before network is fully restored, 'Network request failed'

Hello! I'm developing a mobile app using Expo. I've been following the offline example in the docs (https://tanstack.com/query/v4/docs/examples/react/offline), and it works up until I restore the network connection and try to fire the API call in setMutationDefaults. I get the mutation-variables, and using NetInfo / onlineManager. I can see that the device is online. But when the API-call is made, it errors out and I get TypeError: Network request failed, as if the device isn't online. Has anyone else had this issue? Or is there something obvious I'm missing when using this in combination with react-native? I've read the docs and double checked the official example, but can't figure out what's wrong. Thank you
React Query Offline), Example | TanStack Query Docs
An example showing how to implement Offline), in React Query
1 Reply
adverse-sapphire
adverse-sapphireOP4y ago
Seems to work when I set networkMode: 'offlineFirst, not really sure why. I guess I need to re-read the docs and understand how it all works.

Did you find this page helpful?