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

@@ -22,7 +22,7 @@
* SOFTWARE.
*/
import React from "react";
import { Redirect, Route, Link as RouteLink, Switch, useRouteMatch, match } from "react-router-dom";
import { Redirect, Route, Link as RouteLink, Switch, useRouteMatch } from "react-router-dom";
import { useTranslation } from "react-i18next";
import { binder, ExtensionPoint } from "@scm-manager/ui-extensions";
import { Changeset, Link } from "@scm-manager/ui-types";
@@ -245,7 +245,9 @@ const RepositoryRoot = () => {
<Redirect exact from={`${url}/changesets`} to={`${url}/code/changesets`} />
<Redirect from={`${url}/branch/:branch/changesets`} to={`${url}/code/branch/:branch/changesets/`} />
<Route path={`${url}/info`} exact component={() => <RepositoryDetails repository={repository} />} />
<Route path={`${url}/info`} exact>
<RepositoryDetails repository={repository} />
</Route>
<Route path={`${url}/settings/general`}>
<EditRepo repository={repository} />
</Route>