Enable refetch on focus (#1559)

During the integration of react-query we had to disable the refetch on focus option, because it has cleared our input fields on refocusing the browser tab. This problem comes mostly from a wrong use of routes. Often routes were used with the component prop and a anonymous function e.g.:

```jsx
<Route path="/my/route" component={() => <AwesomeComponent />} />
```

This triggers not only rerendering but remounting of the route component every time the parent is rerendered. With the ongoing work on the migration from redux to react-query, we have removed the usage of routes with component functions. So we can now safely enable the option refetch on mount of react-query.
This commit is contained in:
Sebastian Sdorra
2021-02-25 08:30:23 +01:00
committed by GitHub
parent 3c94ce91d6
commit 367d7294b8
2 changed files with 5 additions and 5 deletions

View File

@@ -31,9 +31,7 @@ import { reset } from "./reset";
const queryClient = new QueryClient({
defaultOptions: {
queries: {
retry: false,
// refetch on focus can reset form inputs
refetchOnWindowFocus: false
retry: false
}
}
});