Closed cseelus closed 2 years ago
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Closing this issue after a prolonged period of inactivity. If this is still present in the latest release, please feel free to create a new issue with up-to-date information.
I think this is an important question. I hope we can at least get some response on whether supporting RTK Query is of interest to the maintainers.
RTKQ doesn't have offline mode support.
It means it cannot detect network status updates and pause/resume actions queue or even outgoing network requests.
There's also no way to change this behavior with configuration. The only thing I saw is that hook that is used to build request headers may be used to pause request until some promise resolves. But it sounds more like a hack.
Moreover, the RTKQ API was designed to support only predefined set of thunk actions, like /pending, /fulfilled and /rejected. I think there's no way to use RTKQ with any kind of offline middleware at the moment.
Did some testing and the approach react-native-offline takes to ease the creation of offline first apps looks very interesting, especially the Redux integration. I could not find any information regarding RTK Query anywhere so far though.
RTK Query is a relatively new 'data fetching and caching tool' from the Redux team, 'eliminating the need to hand-write data fetching & caching logic yourself'.
By very briefly defining queries and mutations to specific API endpoints like
/comments
, RTK Query augments an applications Redux store with matching reducers/actions and provides autogenerated hooks for each endpoint.Basic example:
@rgommezz: Now the question of course is, do you have any knowledge/experience if react-native-offline is compatible with RTK Query (yet), particularly if there is a proper way to add to the
actionQueue
as part of thenetwork
state, when an app is offline?