Skip to content
Source
Sign inSign up
TanStack/query

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

Send to my agent
Closedmiteshdevg(GitHub profile, opens in a new tab) opened this issue 3 comments

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.

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

  2. 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:

  3. TkDodo closed this

  4. TkDodo added labelsinvalid

  5. 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:

    Thank you I found solution and implement offline in react-query

Sign in to join this conversation.