Skip to content

Commit e155c2c

Browse files
committed
chore: use react-router-dom-v5-compat instead of react-router and react-router-dom
Signed-off-by: Jenny Zhu <[email protected]>
1 parent dc9f851 commit e155c2c

File tree

5 files changed

+35
-54
lines changed

5 files changed

+35
-54
lines changed

web/package-lock.json

Lines changed: 26 additions & 46 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

web/package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,6 @@
6060
"react-helmet": "^6.1.0",
6161
"react-i18next": "^11.7.3",
6262
"react-redux": "7.2.2",
63-
"react-router": "5.3.x",
64-
"react-router-dom": "5.3.x",
6563
"style-loader": "^3.3.1",
6664
"stylelint": "^15.3.0",
6765
"stylelint-config-standard": "^31.0.0",
@@ -87,5 +85,8 @@
8785
"dependencies": {
8886
"@console/pluginAPI": "*"
8987
}
88+
},
89+
"dependencies": {
90+
"react-router-dom-v5-compat": "^6.30.0"
9091
}
9192
}

web/src/components/topology/Korrel8rTopology.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ import {
2626
} from '@patternfly/react-topology';
2727
import * as React from 'react';
2828
import { TFunction, useTranslation } from 'react-i18next';
29-
import { useHistory, useLocation } from 'react-router';
29+
import { useNavigate, useLocation } from 'react-router-dom-v5-compat';
3030
import { nodeToLabel } from '../../korrel8r-utils';
3131
import { InvalidNode } from '../../korrel8r/invalid';
3232
import { Korrel8rNode } from '../../korrel8r/korrel8r.types';
@@ -213,7 +213,7 @@ export const Korrel8rTopology: React.FC<{
213213
}> = ({ queryNodes, queryEdges, loggingAvailable, netobserveAvailable, setQuery }) => {
214214
const { t } = useTranslation('plugin__troubleshooting-panel-console-plugin');
215215
const location = useLocation();
216-
const history = useHistory();
216+
const navigate = useNavigate();
217217
const persistedQuery = useSelector((state: State) => {
218218
return state.plugins?.tp?.get('persistedQuery');
219219
}) as Query;
@@ -273,9 +273,9 @@ export const Korrel8rTopology: React.FC<{
273273
goal: null,
274274
constraint: persistedQuery.constraint,
275275
});
276-
history.push('/' + korrel8rNode.toURL());
276+
navigate('/' + korrel8rNode.toURL());
277277
},
278-
[history, nodes, selectedIds, setQuery, persistedQuery],
278+
[navigate, nodes, selectedIds, setQuery, persistedQuery],
279279
);
280280

281281
const controller = React.useMemo(() => {

web/src/hooks/useQueryParams.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import * as React from 'react';
2-
import { useLocation } from 'react-router-dom';
2+
import { useLocation } from 'react-router-dom-v5-compat';
33

44
export const useQueryParams = () => {
55
const location = useLocation();

web/src/hooks/useURLState.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import * as React from 'react';
22
import { useQueryParams } from './useQueryParams';
33
import { Korrel8rNodeFactory } from '../korrel8r/node-factory';
4-
import { useLocation } from 'react-router';
4+
import { useLocation } from 'react-router-dom-v5-compat';
55

66
export type QueryParams = [string, string][];
77

0 commit comments

Comments
 (0)