blog/offline-react-query #76
Replies: 12 comments 15 replies
-
Neat! We have a capacitor app, but we do have some problems with offline support. V4 will definitely be a improvement 💪 |
Beta Was this translation helpful? Give feedback.
-
Great blog series, these articles have been very helpful in migrating our app from plain Axios fetches to having some offline capability via React Query. However, one thing I haven't found in these posts or any of the v4 docs + issues: how should lazy queries work when offline? That is:
At the moment our workaround is to check the online state manually and pull straight from the cache:
Is this a good solution, or is there something better that we're missing? Cheers. |
Beta Was this translation helpful? Give feedback.
-
Thanks for the great article! Just want to confirm if "idle" status is removed from the query result status in favor of "idle" in fetchStatus? |
Beta Was this translation helpful? Give feedback.
-
Hi. I got here because of Offline React Query title but I see that my case is completely different. I am creating an app for a touch screen that will always be in offline mode, with no internet connection at all. One day I was developing without internet connection I noticed that React Query was not making the requests 😅 This is why I'm not sure if this library is really a good choice for this project.... or is there any way to configure React Query correctly for this case? Thanks in advance! |
Beta Was this translation helpful? Give feedback.
-
Can we use storage with React Query to persist the paused requests so app doesn't lose paused requests? |
Beta Was this translation helpful? Give feedback.
-
Nice article! I tried offline mode in v4 and didn’t get how to work with mutations executed offline in a sequential way. What I mean is that we have no internet and do optimistic updates until user comes back online. When it happens queries run in parallel when it’s crucial for the app to run sequentially (some business logic behind API). Any thoughts? |
Beta Was this translation helpful? Give feedback.
-
While using React Query in combination with fetching data via Bluetooth characteristics, I've noticed that data is marked stale whenever the BT connection is lost. I don't want to treat any cached data as stale until I've been |
Beta Was this translation helpful? Give feedback.
-
I have been implementing more and more mutations into a webapp that has grown quite a bit. (30+ mutations) A while back I transitioned to make it a PWA, and now I want to make it a true offline experience in which mutations can be made even when offline. In that regard I have some trouble in how I should structure my code using best practice. In order to be able to make the mutations offline I should register a default mutation function for each one in the query client so the mutation functions are available when mutations resume. Furthermore, I should also wrap the mutations in a hook, when consuming it in my app. So either I should have a file containing all mutation function, which I reference in both the mutation default and the hook. Or not specify the mutation function in the hook so it defaults to the default mutation function. Or maybe a third or fourth way? How would you structure this? Thanks in advance. |
Beta Was this translation helpful? Give feedback.
-
Great article, I'm planing to include RQ to our ongoing project with some colleagues. One Question, is this |
Beta Was this translation helpful? Give feedback.
-
Very informative. I have an app I built 5+ years ago and refactoring it and would like to consider replacing redux, redux-thunk, redux-persist, etc. with React Query. I also used Watermelon DB to handle storage of large datasets locally on the device. I was curious if you had a recommendation for the storage layer for persisting data when the user is offline. for a React-Native app using React Query. I see mention of local cache for the browser. Thank you in advance. |
Beta Was this translation helpful? Give feedback.
-
How we can handle a repeating CRUD mutations in react query? I mean let's say I have a profile image uploading feature, and I add an image, update it to another and delete it and add a new image, when offline. I used networkMode: 'offlineFirst', retry: true, for mutations. I'm using expo image picker, react-native-async-storage/async-storage, react-native-community/netinfo, tanstack/query-async-storage-persister, tanstack/react-query-persist-client. I feel mutation requests not retrying as a queue when I'm back online. What can be the issue for this? |
Beta Was this translation helpful? Give feedback.
-
Is there a way to configure networkMode globally? |
Beta Was this translation helpful? Give feedback.
-
Offline React Query | TkDodo's blog
A glimpse at what v4 will bring for offline queries
https://tkdodo.eu/blog/offline-react-query
Beta Was this translation helpful? Give feedback.
All reactions