reduxjs / redux-toolkit

The official, opinionated, batteries-included toolset for efficient Redux development
https://redux-toolkit.js.org
MIT License
10.76k stars 1.18k forks source link

Prevent persisted data from changing when request got network errors like ERR_CONNECTION_RESET #4680

Closed MHasannejadi closed 4 weeks ago

MHasannejadi commented 4 weeks ago

Hello, I have a react project with rtk and rtk query as data flow and API handlers and redux persist to store data in the browser. Now I have a problem using rtk query and is that when the user gets network errors like ERR_CONNECTION_RESET rtk query, it changes data to an empty value and I can't access previously persisted data. Is there a way to rtk change data only when the request is successful?