TanStack / query

🤖 Powerful asynchronous state management, server-state utilities and data fetching for the web. TS/JS, React Query, Solid Query, Svelte Query and Vue Query.
https://tanstack.com/query
MIT License
40.53k stars 2.73k forks source link

Handling Offline Mutations Persistently Across App Restarts in React Query v5 #7384

Closed miteshdevg closed 1 month ago

miteshdevg commented 1 month ago

Describe the bug

When using React Query v5 for data fetching and mutations in a React Native application, there's a common scenario where mutations need to be performed offline and persisted across app restarts.

Your minimal, reproducible example

i can't share my code sorry ,

Steps to reproduce

  1. Initialize a mutation with React Query in a React Native app.
  2. Go offline and trigger the mutation.
  3. Kill the app before going back online.
  4. Restart the app and observe that the mutation has not persisted.

Expected behavior

When a mutation is triggered while the application is offline, it should be saved in a pending state. Once the app is online, or when the app restarts and regains connectivity, these pending mutations should automatically be retried.

How often does this bug happen?

None

Screenshots or Videos

No response

Platform

android , ios

Tanstack Query adapter

react-query

TanStack Query version

^5.28.9

TypeScript version

^5.1.6

Additional context

This functionality is crucial for ensuring data integrity and user experience in mobile applications that may frequently lose connection or close unexpectedly.

miteshdevg commented 1 month ago

Please don't close directly give me instructions, how I can resolve the error @TkDodo can you please help me

TkDodo commented 1 month ago

Please don't file bug reports for things that clearly aren't bugs, but just misunderstandings where you need guidance. We have GitHub Discussions and an active Discord server for these.

you want: