Skip to content
Discussion options

You must be logged in to vote

I got it to work with some custom code, posting it here to share in case anyone else encounters this blocker.
After finding the onlineManager while browsing the source code and reading more about it in the docs, here's what I came up with:

onlineManager.setEventListener((setOnline) => {
  return NetInfo.addEventListener((state) => {
    if (state.isConnected) {
      client.setDefaultOptions({
        queries: {
          cacheTime,
          staleTime,
        }
      });
    } else {
      // keep cache until back online
      client.setDefaultOptions({
        queries: {
          cacheTime: 'Infinity',
          staleTime: 'Infinity',
        }
      });
    }
    setOnline(state.isCo…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by bombillazo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant