redux-toolkit icon indicating copy to clipboard operation
redux-toolkit copied to clipboard

Skipping all network requests if the user is offline as it keeps trying to refetch the data on failing.

Open rehmankhan-cloudways opened this issue 3 years ago • 1 comments

Currently, I can prevent an individual network request (query) with "skip" option provided by RTK Query.

I want to skip all the queries from happening if the user is offline. what should I do to prevent recursive network request after failing as there's no option available to skip all the queries.

I've tried using AbortSignal and maxRetries, but that didn't work for me.

Is there's any better way to handle this ^.

rehmankhan-cloudways avatar Jun 20 '22 13:06 rehmankhan-cloudways

Not really at this moment, I'm sorry.

phryneas avatar Jun 20 '22 21:06 phryneas

@rehmankhan-cloudways Maybe try this approach, curtesy of @phryneas: https://github.com/reduxjs/redux-toolkit/issues/2916#issuecomment-1324630525

A global skip option would indeed be nice though, for such use cases.

cseelus avatar Feb 10 '23 16:02 cseelus