v2.1.0
2.1.0 (2020-06-24)
Bug Fixes
- suspense boundaries now catch query errors accurately
Features
- added queryCache.resetErrorBoundaries (4c741f7)
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>
)}
>