🤖 Powerful asynchronous state management, server-state utilities and data fetching for the web. TS/JS, React Query, Solid Query, Svelte Query and Vue Query.
MIT License
Bot releases are visible (Hide)
Published by tannerlinsley over 4 years ago
Published by tannerlinsley over 4 years ago
Whether you are using suspense or useErrorBoundaries in your queries, you will need to know how to use the queryCache.resetErrorBoundaries
function to let queries know that you want them to try again when you render them again.
How you trigger this function is up to you, but the most common use case is to do it in something like react-error-boundary
's onReset
callback:
import { queryCache } from "react-query";
import { ErrorBoundary } from "react-error-boundary";
<ErrorBoundary
onReset={() => queryCache.resetErrorBoundaries()}
fallbackRender={({ error, resetErrorBoundary }) => (
<div>
There was an error!
<Button onClick={() => resetErrorBoundary()}>Try again</Button>
</div>
)}
>