Skip to content

Commit c6abe6a

Browse files
committed
Hide react-router deprecation warnings in our default router
1 parent cdfffad commit c6abe6a

File tree

8 files changed

+62
-35
lines changed

8 files changed

+62
-35
lines changed

examples/crm/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@
2020
"react-cropper": "^2.3.3",
2121
"react-dom": "^18.3.1",
2222
"react-error-boundary": "^4.0.3",
23-
"react-router": "^6.22.0",
24-
"react-router-dom": "^6.22.0"
23+
"react-router": "^6.28.1",
24+
"react-router-dom": "^6.28.1"
2525
},
2626
"devDependencies": {
2727
"@testing-library/jest-dom": "^6.4.5",

examples/simple/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@
2525
"react-admin": "^5.4.4",
2626
"react-dom": "^18.3.1",
2727
"react-hook-form": "^7.53.0",
28-
"react-router": "^6.25.1",
29-
"react-router-dom": "^6.25.1"
28+
"react-router": "^6.28.1",
29+
"react-router-dom": "^6.28.1"
3030
},
3131
"devDependencies": {
3232
"@hookform/devtools": "^4.3.3",

packages/ra-core/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@
4141
"react": "^18.3.1",
4242
"react-dom": "^18.3.1",
4343
"react-hook-form": "^7.53.0",
44-
"react-router": "^6.25.1",
45-
"react-router-dom": "^6.25.1",
44+
"react-router": "^6.28.1",
45+
"react-router-dom": "^6.28.1",
4646
"recharts": "^2.1.15",
4747
"rimraf": "^3.0.2",
4848
"typescript": "^5.1.3",
@@ -53,8 +53,8 @@
5353
"react": "^18.0.0 || ^19.0.0",
5454
"react-dom": "^18.0.0 || ^19.0.0",
5555
"react-hook-form": "^7.53.0",
56-
"react-router": "^6.25.1 || ^7.1.1",
57-
"react-router-dom": "^6.25.1 || ^7.1.1"
56+
"react-router": "^6.28.1 || ^7.1.1",
57+
"react-router-dom": "^6.28.1 || ^7.1.1"
5858
},
5959
"dependencies": {
6060
"@tanstack/react-query": "^5.21.7",

packages/ra-core/src/routing/AdminRouter.tsx

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import {
44
useInRouterContext,
55
createHashRouter,
66
RouterProvider,
7+
FutureConfig,
78
} from 'react-router-dom';
89

910
import { BasenameContextProvider } from './BasenameContextProvider';
@@ -35,6 +36,10 @@ const DummyRouter = ({
3536
basename?: string;
3637
}) => <>{children}</>;
3738

39+
const routerProviderFuture: Partial<Pick<FutureConfig, 'v7_startTransition'>> =
40+
// @ts-expect-error react-router types are not up-to-date
41+
{ v7_startTransition: false, v7_relativeSplatPath: false };
42+
3843
const InternalRouter = ({
3944
children,
4045
basename,
@@ -44,6 +49,13 @@ const InternalRouter = ({
4449
}) => {
4550
const router = createHashRouter([{ path: '*', element: <>{children}</> }], {
4651
basename,
52+
future: {
53+
v7_fetcherPersist: false,
54+
v7_normalizeFormMethod: false,
55+
v7_partialHydration: false,
56+
v7_relativeSplatPath: false,
57+
v7_skipActionErrorRevalidation: false,
58+
},
4759
});
48-
return <RouterProvider router={router} />;
60+
return <RouterProvider router={router} future={routerProviderFuture} />;
4961
};

packages/ra-core/src/routing/TestMemoryRouter.tsx

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,22 @@ export const TestMemoryRouter = ({
6969
),
7070
},
7171
],
72-
{ ...rest }
72+
{
73+
future: {
74+
v7_fetcherPersist: false,
75+
v7_normalizeFormMethod: false,
76+
v7_partialHydration: false,
77+
v7_relativeSplatPath: false,
78+
v7_skipActionErrorRevalidation: false,
79+
},
80+
...rest,
81+
}
82+
);
83+
return (
84+
<RouterProvider
85+
router={router}
86+
// @ts-expect-error react-router types are not up-to-date
87+
future={{ v7_startTransition: false, v7_relativeSplatPath: false }}
88+
/>
7389
);
74-
return <RouterProvider router={router} />;
7590
};

packages/ra-ui-materialui/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@
4646
"react-dom": "^18.3.1",
4747
"react-hook-form": "^7.53.0",
4848
"react-is": "^18.2.0 || ^19.0.0",
49-
"react-router": "^6.25.1",
50-
"react-router-dom": "^6.25.1",
49+
"react-router": "^6.28.1",
50+
"react-router-dom": "^6.28.1",
5151
"rimraf": "^3.0.2",
5252
"typescript": "^5.1.3"
5353
},
@@ -60,8 +60,8 @@
6060
"react-dom": "^18.0.0 || ^19.0.0",
6161
"react-hook-form": "*",
6262
"react-is": "^18.0.0 || ^19.0.0",
63-
"react-router": "^6.25.1 || ^7.1.1",
64-
"react-router-dom": "^6.25.1 || ^7.1.1"
63+
"react-router": "^6.28.1 || ^7.1.1",
64+
"react-router-dom": "^6.28.1 || ^7.1.1"
6565
},
6666
"dependencies": {
6767
"@tanstack/react-query": "^5.21.7",

packages/react-admin/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@
2828
"devDependencies": {
2929
"cross-env": "^5.2.0",
3030
"expect": "^27.4.6",
31-
"react-router": "^6.25.1",
32-
"react-router-dom": "^6.25.1",
31+
"react-router": "^6.28.1",
32+
"react-router-dom": "^6.28.1",
3333
"rimraf": "^3.0.2",
3434
"typescript": "^5.1.3"
3535
},
@@ -47,8 +47,8 @@
4747
"ra-language-english": "^5.4.3",
4848
"ra-ui-materialui": "^5.4.3",
4949
"react-hook-form": "^7.53.0",
50-
"react-router": "^6.25.1 || ^7.1.1",
51-
"react-router-dom": "^6.25.1 || ^7.1.1"
50+
"react-router": "^6.28.1 || ^7.1.1",
51+
"react-router-dom": "^6.28.1 || ^7.1.1"
5252
},
5353
"gitHead": "587df4c27bfcec4a756df4f95e5fc14728dfc0d7"
5454
}

yarn.lock

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -16098,8 +16098,8 @@ __metadata:
1609816098
react-error-boundary: "npm:^4.0.13"
1609916099
react-hook-form: "npm:^7.53.0"
1610016100
react-is: "npm:^18.2.0 || ^19.0.0"
16101-
react-router: "npm:^6.25.1"
16102-
react-router-dom: "npm:^6.25.1"
16101+
react-router: "npm:^6.28.1"
16102+
react-router-dom: "npm:^6.28.1"
1610316103
recharts: "npm:^2.1.15"
1610416104
rimraf: "npm:^3.0.2"
1610516105
typescript: "npm:^5.1.3"
@@ -16109,8 +16109,8 @@ __metadata:
1610916109
react: ^18.0.0 || ^19.0.0
1611016110
react-dom: ^18.0.0 || ^19.0.0
1611116111
react-hook-form: ^7.53.0
16112-
react-router: ^6.25.1 || ^7.1.1
16113-
react-router-dom: ^6.25.1 || ^7.1.1
16112+
react-router: ^6.28.1 || ^7.1.1
16113+
react-router-dom: ^6.28.1 || ^7.1.1
1611416114
languageName: unknown
1611516115
linkType: soft
1611616116

@@ -16374,8 +16374,8 @@ __metadata:
1637416374
react-error-boundary: "npm:^4.0.13"
1637516375
react-hook-form: "npm:^7.53.0"
1637616376
react-is: "npm:^18.2.0 || ^19.0.0"
16377-
react-router: "npm:^6.25.1"
16378-
react-router-dom: "npm:^6.25.1"
16377+
react-router: "npm:^6.28.1"
16378+
react-router-dom: "npm:^6.28.1"
1637916379
react-transition-group: "npm:^4.4.5"
1638016380
rimraf: "npm:^3.0.2"
1638116381
typescript: "npm:^5.1.3"
@@ -16388,8 +16388,8 @@ __metadata:
1638816388
react-dom: ^18.0.0 || ^19.0.0
1638916389
react-hook-form: "*"
1639016390
react-is: ^18.0.0 || ^19.0.0
16391-
react-router: ^6.25.1 || ^7.1.1
16392-
react-router-dom: ^6.25.1 || ^7.1.1
16391+
react-router: ^6.28.1 || ^7.1.1
16392+
react-router-dom: ^6.28.1 || ^7.1.1
1639316393
languageName: unknown
1639416394
linkType: soft
1639516395

@@ -16468,8 +16468,8 @@ __metadata:
1646816468
react-cropper: "npm:^2.3.3"
1646916469
react-dom: "npm:^18.3.1"
1647016470
react-error-boundary: "npm:^4.0.3"
16471-
react-router: "npm:^6.22.0"
16472-
react-router-dom: "npm:^6.22.0"
16471+
react-router: "npm:^6.28.1"
16472+
react-router-dom: "npm:^6.28.1"
1647316473
rollup-plugin-visualizer: "npm:^5.12.0"
1647416474
rollup-preserve-directives: "npm:^1.1.1"
1647516475
typescript: "npm:^5.1.3"
@@ -16541,8 +16541,8 @@ __metadata:
1654116541
ra-language-english: "npm:^5.4.3"
1654216542
ra-ui-materialui: "npm:^5.4.3"
1654316543
react-hook-form: "npm:^7.53.0"
16544-
react-router: "npm:^6.25.1"
16545-
react-router-dom: "npm:^6.25.1"
16544+
react-router: "npm:^6.28.1"
16545+
react-router-dom: "npm:^6.28.1"
1654616546
rimraf: "npm:^3.0.2"
1654716547
typescript: "npm:^5.1.3"
1654816548
peerDependencies:
@@ -16768,7 +16768,7 @@ __metadata:
1676816768
languageName: node
1676916769
linkType: hard
1677016770

16771-
"react-router-dom@npm:^6.22.0, react-router-dom@npm:^6.25.1":
16771+
"react-router-dom@npm:^6.22.0, react-router-dom@npm:^6.28.1":
1677216772
version: 6.28.1
1677316773
resolution: "react-router-dom@npm:6.28.1"
1677416774
dependencies:
@@ -16793,7 +16793,7 @@ __metadata:
1679316793
languageName: node
1679416794
linkType: hard
1679516795

16796-
"react-router@npm:6.28.1, react-router@npm:^6.22.0, react-router@npm:^6.25.1":
16796+
"react-router@npm:6.28.1, react-router@npm:^6.22.0, react-router@npm:^6.28.1":
1679716797
version: 6.28.1
1679816798
resolution: "react-router@npm:6.28.1"
1679916799
dependencies:
@@ -17926,8 +17926,8 @@ __metadata:
1792617926
react-admin: "npm:^5.4.4"
1792717927
react-dom: "npm:^18.3.1"
1792817928
react-hook-form: "npm:^7.53.0"
17929-
react-router: "npm:^6.25.1"
17930-
react-router-dom: "npm:^6.25.1"
17929+
react-router: "npm:^6.28.1"
17930+
react-router-dom: "npm:^6.28.1"
1793117931
react-simple-animate: "npm:^3.5.3"
1793217932
typescript: "npm:^5.1.3"
1793317933
vite: "npm:^5.0.11"

0 commit comments

Comments
 (0)