Skip to content

Commit

Permalink
Add support for react-router v7
Browse files Browse the repository at this point in the history
  • Loading branch information
djhi committed Jan 9, 2025
1 parent 0d43384 commit 07da231
Show file tree
Hide file tree
Showing 15 changed files with 88 additions and 26 deletions.
4 changes: 2 additions & 2 deletions examples/demo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@
"react": "^19.0.0",
"react-admin": "^5.0.0",
"react-dom": "^19.0.0",
"react-router": "^6.22.0",
"react-router-dom": "^6.22.0",
"react-router": "^7.1.1",
"react-router-dom": "^7.1.1",
"recharts": "^2.1.15"
},
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion examples/demo/src/categories/LinkToRelatedProducts.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as React from 'react';
import Button from '@mui/material/Button';
import { Link } from 'react-router-dom';
import { Link } from 'react-router';
import { useTranslate, useRecordContext } from 'react-admin';
import { stringify } from 'query-string';

Expand Down
2 changes: 1 addition & 1 deletion examples/demo/src/dashboard/CardWithIcon.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as React from 'react';
import { FC, createElement } from 'react';
import { Card, Box, Typography, Divider } from '@mui/material';
import { Link, To } from 'react-router-dom';
import { Link, To } from 'react-router';
import { ReactNode } from 'react';

interface Props {
Expand Down
2 changes: 1 addition & 1 deletion examples/demo/src/dashboard/NewCustomers.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as React from 'react';
import { Avatar, Box, Button } from '@mui/material';
import CustomerIcon from '@mui/icons-material/PersonAdd';
import { Link } from 'react-router-dom';
import { Link } from 'react-router';
import {
ListBase,
WithListContext,
Expand Down
2 changes: 1 addition & 1 deletion examples/demo/src/dashboard/PendingOrder.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
Box,
ListItemButton,
} from '@mui/material';
import { Link } from 'react-router-dom';
import { Link } from 'react-router';
import { useTranslate, useReference } from 'react-admin';

import { Customer, Order } from '../types';
Expand Down
2 changes: 1 addition & 1 deletion examples/demo/src/dashboard/PendingReviews.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
ListItemText,
} from '@mui/material';
import CommentIcon from '@mui/icons-material/Comment';
import { Link } from 'react-router-dom';
import { Link } from 'react-router';

import {
ReferenceField,
Expand Down
2 changes: 1 addition & 1 deletion examples/demo/src/layout/Login.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as React from 'react';
import { useState } from 'react';
import { useLocation } from 'react-router-dom';
import { useLocation } from 'react-router';

import {
Avatar,
Expand Down
2 changes: 1 addition & 1 deletion examples/demo/src/products/GridList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import * as React from 'react';
import { useTheme, useMediaQuery } from '@mui/material';
import { Box, ImageList, ImageListItem, ImageListItemBar } from '@mui/material';
import { useCreatePath, NumberField, useListContext } from 'react-admin';
import { Link } from 'react-router-dom';
import { Link } from 'react-router';

const GridList = () => {
const { isPending } = useListContext();
Expand Down
2 changes: 1 addition & 1 deletion examples/demo/src/reviews/ReviewList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
SelectColumnsButton,
TopToolbar,
} from 'react-admin';
import { matchPath, useLocation, useNavigate } from 'react-router-dom';
import { matchPath, useLocation, useNavigate } from 'react-router';
import { Box, Drawer, useMediaQuery, Theme } from '@mui/material';

import ReviewListMobile from './ReviewListMobile';
Expand Down
2 changes: 1 addition & 1 deletion examples/demo/src/segments/LinkToRelatedCustomers.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as React from 'react';
import { Button } from '@mui/material';
import { Link } from 'react-router-dom';
import { Link } from 'react-router';
import { useTranslate } from 'react-admin';
import { stringify } from 'query-string';

Expand Down
4 changes: 3 additions & 1 deletion examples/tutorial/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@
"ra-data-json-server": "^5.0.0",
"react": "^19.0.0",
"react-admin": "^5.0.0",
"react-dom": "^19.0.0"
"react-dom": "^19.0.0",
"react-router": "^7.1.1",
"react-router-dom": "^7.1.1"
},
"devDependencies": {
"@types/react": "^18.3.3",
Expand Down
4 changes: 2 additions & 2 deletions packages/ra-core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@
"react": "^18.0.0 || ^19.0.0",
"react-dom": "^18.0.0 || ^19.0.0",
"react-hook-form": "^7.53.0",
"react-router": "^6.22.0",
"react-router-dom": "^6.22.0"
"react-router": "^6.22.0 || ^7.0.0",
"react-router-dom": "^6.22.0 || ^7.0.0"
},
"dependencies": {
"@tanstack/react-query": "^5.21.7",
Expand Down
4 changes: 2 additions & 2 deletions packages/ra-ui-materialui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@
"react-dom": "^18.0.0 || ^19.0.0",
"react-hook-form": "*",
"react-is": "^18.0.0 || ^19.0.0",
"react-router": "^6.22.0",
"react-router-dom": "^6.22.0"
"react-router": "^6.22.0 || ^7.0.0",
"react-router-dom": "^6.22.0 || ^7.0.0"
},
"dependencies": {
"@tanstack/react-query": "^5.21.7",
Expand Down
4 changes: 2 additions & 2 deletions packages/react-admin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@
"ra-language-english": "^5.4.3",
"ra-ui-materialui": "^5.4.3",
"react-hook-form": "^7.53.0",
"react-router": "^6.22.0",
"react-router-dom": "^6.22.0"
"react-router": "^6.22.0 || ^7.0.0",
"react-router-dom": "^6.22.0 || ^7.0.0"
},
"gitHead": "587df4c27bfcec4a756df4f95e5fc14728dfc0d7"
}
76 changes: 68 additions & 8 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4836,6 +4836,13 @@ __metadata:
languageName: node
linkType: hard

"@types/cookie@npm:^0.6.0":
version: 0.6.0
resolution: "@types/cookie@npm:0.6.0"
checksum: 5b326bd0188120fb32c0be086b141b1481fec9941b76ad537f9110e10d61ee2636beac145463319c71e4be67a17e85b81ca9e13ceb6e3bb63b93d16824d6c149
languageName: node
linkType: hard

"@types/d3-color@npm:^2":
version: 2.0.3
resolution: "@types/d3-color@npm:2.0.3"
Expand Down Expand Up @@ -7624,6 +7631,13 @@ __metadata:
languageName: node
linkType: hard

"cookie@npm:^1.0.1":
version: 1.0.2
resolution: "cookie@npm:1.0.2"
checksum: fd25fe79e8fbcfcaf6aa61cd081c55d144eeeba755206c058682257cb38c4bd6795c6620de3f064c740695bb65b7949ebb1db7a95e4636efb8357a335ad3f54b
languageName: node
linkType: hard

"core-js-compat@npm:^3.20.0, core-js-compat@npm:^3.31.0, core-js-compat@npm:^3.36.1":
version: 3.37.1
resolution: "core-js-compat@npm:3.37.1"
Expand Down Expand Up @@ -8351,8 +8365,8 @@ __metadata:
react: "npm:^19.0.0"
react-admin: "npm:^5.0.0"
react-dom: "npm:^19.0.0"
react-router: "npm:^6.22.0"
react-router-dom: "npm:^6.22.0"
react-router: "npm:^7.1.1"
react-router-dom: "npm:^7.1.1"
recharts: "npm:^2.1.15"
rewire: "npm:^5.0.0"
rollup-plugin-visualizer: "npm:^5.12.0"
Expand Down Expand Up @@ -15940,8 +15954,8 @@ __metadata:
react: ^18.0.0 || ^19.0.0
react-dom: ^18.0.0 || ^19.0.0
react-hook-form: ^7.53.0
react-router: ^6.22.0
react-router-dom: ^6.22.0
react-router: ^6.22.0 || ^7.0.0
react-router-dom: ^6.22.0 || ^7.0.0
languageName: unknown
linkType: soft

Expand Down Expand Up @@ -16219,8 +16233,8 @@ __metadata:
react-dom: ^18.0.0 || ^19.0.0
react-hook-form: "*"
react-is: ^18.0.0 || ^19.0.0
react-router: ^6.22.0
react-router-dom: ^6.22.0
react-router: ^6.22.0 || ^7.0.0
react-router-dom: ^6.22.0 || ^7.0.0
languageName: unknown
linkType: soft

Expand Down Expand Up @@ -16370,8 +16384,8 @@ __metadata:
ra-language-english: "npm:^5.4.3"
ra-ui-materialui: "npm:^5.4.3"
react-hook-form: "npm:^7.53.0"
react-router: "npm:^6.22.0"
react-router-dom: "npm:^6.22.0"
react-router: "npm:^6.22.0 || ^7.0.0"
react-router-dom: "npm:^6.22.0 || ^7.0.0"
rimraf: "npm:^3.0.2"
typescript: "npm:^5.1.3"
peerDependencies:
Expand Down Expand Up @@ -16590,6 +16604,18 @@ __metadata:
languageName: node
linkType: hard

"react-router-dom@npm:^6.22.0 || ^7.0.0, react-router-dom@npm:^7.1.1":
version: 7.1.1
resolution: "react-router-dom@npm:7.1.1"
dependencies:
react-router: "npm:7.1.1"
peerDependencies:
react: ">=18"
react-dom: ">=18"
checksum: 2dc5b231dd21aab21378c615b1e373149007d173e90db984e6f708b5ee4b28923b3cf88ce7d6f727be927829b37ba37c01436f9f7abeb84ba3d1bfc9ecd4bc72
languageName: node
linkType: hard

"react-router-dom@npm:^6.22.0, react-router-dom@npm:^6.25.1":
version: 6.25.1
resolution: "react-router-dom@npm:6.25.1"
Expand All @@ -16614,6 +16640,24 @@ __metadata:
languageName: node
linkType: hard

"react-router@npm:7.1.1, react-router@npm:^6.22.0 || ^7.0.0, react-router@npm:^7.1.1":
version: 7.1.1
resolution: "react-router@npm:7.1.1"
dependencies:
"@types/cookie": "npm:^0.6.0"
cookie: "npm:^1.0.1"
set-cookie-parser: "npm:^2.6.0"
turbo-stream: "npm:2.4.0"
peerDependencies:
react: ">=18"
react-dom: ">=18"
peerDependenciesMeta:
react-dom:
optional: true
checksum: 39f4859670f286eb2eac29e5830c1f730405701fca0808e5db853ec05e54e55a848c764e10ffd14a7b9b3b2154a0d6449656d7f208b9b3e4b2af780e07bf57a8
languageName: node
linkType: hard

"react-simple-animate@npm:^3.3.12":
version: 3.3.12
resolution: "react-simple-animate@npm:3.3.12"
Expand Down Expand Up @@ -17544,6 +17588,13 @@ __metadata:
languageName: node
linkType: hard

"set-cookie-parser@npm:^2.6.0":
version: 2.7.1
resolution: "set-cookie-parser@npm:2.7.1"
checksum: 060c198c4c92547ac15988256f445eae523f57f2ceefeccf52d30d75dedf6bff22b9c26f756bd44e8e560d44ff4ab2130b178bd2e52ef5571bf7be3bd7632d9a
languageName: node
linkType: hard

"set-function-length@npm:^1.2.1":
version: 1.2.2
resolution: "set-function-length@npm:1.2.2"
Expand Down Expand Up @@ -18765,6 +18816,13 @@ __metadata:
languageName: node
linkType: hard

"turbo-stream@npm:2.4.0":
version: 2.4.0
resolution: "turbo-stream@npm:2.4.0"
checksum: e68b2569f1f16e6e9633d090c6024b2ae9f0e97bfeacb572451ca3732e120ebbb546f3bc4afc717c46cb57b5aea6104e04ef497f9912eef6a7641e809518e98a
languageName: node
linkType: hard

"tutorial@workspace:examples/tutorial":
version: 0.0.0-use.local
resolution: "tutorial@workspace:examples/tutorial"
Expand All @@ -18778,6 +18836,8 @@ __metadata:
react: "npm:^19.0.0"
react-admin: "npm:^5.0.0"
react-dom: "npm:^19.0.0"
react-router: "npm:^7.1.1"
react-router-dom: "npm:^7.1.1"
typescript: "npm:^5.1.3"
vite: "npm:^5.0.11"
languageName: unknown
Expand Down

0 comments on commit 07da231

Please sign in to comment.