TanStackT
TanStack2y ago
18 replies
sacred-rose

refetchOnReconnect with Suspense query

Hey, guys. I'm using React Native and I have a question, not sure if it's a bug.

When using
useSuspenseQuery
with Suspense (obviously), ErrorBoundary and QueryErrorResetBoundary, if I access a screen without internet connection, an error will be thrown since API can't be reached, but after reconnecting, the error is NOT automatically reset.

That scenario would work fine with
useQuery
.

I made some research and I found there is a resetKeys option of react-error-boundary that I could change whenever connection status change.
If that is actually the final solution, I think we should make it clear in the docs, especially on the React Native guide (https://tanstack.com/query/latest/docs/framework/react/react-native#online-status-management)
React Query is designed to work out of the box with React Native, with the exception of the devtools, which are only supported with React DOM at this time.

There is a 3rd party Flipper plugin which you can try: https://github.com/bgaleotti/react-query-native-devtools
React Native | TanStack Query React Docs
Was this page helpful?