mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-07 05:55:44 +01:00
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:
@@ -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
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user