Skip to content

Commit

Permalink
Fix: Address warnings of React Router
Browse files Browse the repository at this point in the history
Update to react-router-dom 6.28.1 which will not raise warnings if the
future config setting of a router is set.

Enable the start transition setting for react router which should be
fine because we don't user React.lazy (yet).

Disable relative splat path because I am not sure if it will affect GSA.
  • Loading branch information
bjoernricks committed Jan 15, 2025
1 parent 30401d5 commit c1861cc
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 14 deletions.
19 changes: 11 additions & 8 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
"react-dom": "^18.3.1",
"react-i18next": "^15.4.0",
"react-redux": "^9.1.2",
"react-router-dom": "^6.28.0",
"react-router-dom": "^6.28.1",
"redux": "^5.0.1",
"redux-logger": "^3.0.6",
"resize-observer-polyfill": "^1.5.1",
Expand Down
22 changes: 18 additions & 4 deletions src/web/routes.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -213,9 +213,14 @@ const LoggedInRoutes = () => {

<Route element={<PageNotFound />} path="/notfound" />
<Route element={<AuditReportsPage />} path="/auditreports" />
<Route element={<DeltaAuditReportDetailsPage />}
path="/auditreport/delta/:id/:deltaid" />
<Route element= {<AuditReportDetailsPage />} path="/auditreport/:id" />
<Route
element={<DeltaAuditReportDetailsPage />}
path="/auditreport/delta/:id/:deltaid"
/>
<Route
element={<AuditReportDetailsPage />}
path="/auditreport/:id"
/>

Check warning on line 223 in src/web/routes.jsx

View check run for this annotation

Codecov / codecov/patch

src/web/routes.jsx#L216-L223

Added lines #L216 - L223 were not covered by tests
<Route element={<Navigate to="/dashboards" />} path="/" />

<Route element={<PageNotFound />} path="*" />
Expand All @@ -241,7 +246,16 @@ const AppRoutes = () => {
}

return (
<Router>{isLoggedIn ? <LoggedInRoutes /> : <LoggedOutRoutes />}</Router>
<Router
future={{

Check warning on line 250 in src/web/routes.jsx

View check run for this annotation

Codecov / codecov/patch

src/web/routes.jsx#L249-L250

Added lines #L249 - L250 were not covered by tests
// eslint-disable-next-line camelcase
v7_startTransition: true,

Check warning on line 252 in src/web/routes.jsx

View check run for this annotation

Codecov / codecov/patch

src/web/routes.jsx#L252

Added line #L252 was not covered by tests
// eslint-disable-next-line camelcase
v7_relativeSplatPath: false,
}}

Check warning on line 255 in src/web/routes.jsx

View check run for this annotation

Codecov / codecov/patch

src/web/routes.jsx#L254-L255

Added lines #L254 - L255 were not covered by tests
>
{isLoggedIn ? <LoggedInRoutes /> : <LoggedOutRoutes />}
</Router>

Check warning on line 258 in src/web/routes.jsx

View check run for this annotation

Codecov / codecov/patch

src/web/routes.jsx#L257-L258

Added lines #L257 - L258 were not covered by tests
);
};

Expand Down
12 changes: 11 additions & 1 deletion src/web/utils/testing.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,17 @@ export const rendererWith = (
<TestingLicenseProvider license={license}>
<TestingStoreProvider store={store}>
{router ? (
<BrowserRouter initialEntries={['/']}>{children}</BrowserRouter>
<BrowserRouter
future={{
// eslint-disable-next-line camelcase
v7_startTransition: true,
// eslint-disable-next-line camelcase
v7_relativeSplatPath: false,
}}
initialEntries={['/']}
>
{children}
</BrowserRouter>
) : (
children
)}
Expand Down

0 comments on commit c1861cc

Please sign in to comment.