R: Upgrade to react-router v7
This commit is contained in:
parent
01b1ade339
commit
39c972eeea
|
@ -31,7 +31,7 @@ This readme file is used mostly to document project dependencies and conventions
|
|||
- axios
|
||||
- clsx
|
||||
- react-icons
|
||||
- react-router-dom
|
||||
- react-router
|
||||
- react-toastify
|
||||
- react-loader-spinner
|
||||
- react-tabs
|
||||
|
|
24
rsconcept/frontend/package-lock.json
generated
24
rsconcept/frontend/package-lock.json
generated
|
@ -25,7 +25,7 @@
|
|||
"react-icons": "^5.3.0",
|
||||
"react-intl": "^7.0.1",
|
||||
"react-loader-spinner": "^6.1.6",
|
||||
"react-router-dom": "^7.0.0",
|
||||
"react-router": "^7.0.1",
|
||||
"react-select": "^5.8.3",
|
||||
"react-tabs": "^6.0.2",
|
||||
"react-toastify": "^10.0.6",
|
||||
|
@ -9268,9 +9268,9 @@
|
|||
}
|
||||
},
|
||||
"node_modules/react-router": {
|
||||
"version": "7.0.0",
|
||||
"resolved": "https://registry.npmjs.org/react-router/-/react-router-7.0.0.tgz",
|
||||
"integrity": "sha512-1xf+yMVhUjAzZGY90ZnYJ9KVe1R8FggpugzRBkh+p6vl4cC1sHDe3nO+r5rxWTAgCMf8uN5hfoV2M7rLVTWPUA==",
|
||||
"version": "7.0.1",
|
||||
"resolved": "https://registry.npmjs.org/react-router/-/react-router-7.0.1.tgz",
|
||||
"integrity": "sha512-WVAhv9oWCNsja5AkK6KLpXJDSJCQizOIyOd4vvB/+eHGbYx5vkhcmcmwWjQ9yqkRClogi+xjEg9fNEOd5EX/tw==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@types/cookie": "^0.6.0",
|
||||
|
@ -9291,22 +9291,6 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"node_modules/react-router-dom": {
|
||||
"version": "7.0.0",
|
||||
"resolved": "https://registry.npmjs.org/react-router-dom/-/react-router-dom-7.0.0.tgz",
|
||||
"integrity": "sha512-2QAxXpwgQuh423C64oZiV2cCKPCNUgZxcvZaS8O0PAHPZ/z8kTq7YbGD4KTNZm6Yj66d+HAfGkWPp8MCpdtD+Q==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"react-router": "7.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=20.0.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"react": ">=18",
|
||||
"react-dom": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/react-select": {
|
||||
"version": "5.8.3",
|
||||
"resolved": "https://registry.npmjs.org/react-select/-/react-select-5.8.3.tgz",
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
"react-icons": "^5.3.0",
|
||||
"react-intl": "^7.0.1",
|
||||
"react-loader-spinner": "^6.1.6",
|
||||
"react-router-dom": "^7.0.0",
|
||||
"react-router": "^7.0.1",
|
||||
"react-select": "^5.8.3",
|
||||
"react-tabs": "^6.0.2",
|
||||
"react-toastify": "^10.0.6",
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { Outlet } from 'react-router-dom';
|
||||
import { Outlet } from 'react-router';
|
||||
|
||||
import ConceptToaster from '@/app/ConceptToaster';
|
||||
import Footer from '@/app/Footer';
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { createBrowserRouter } from 'react-router-dom';
|
||||
import { createBrowserRouter } from 'react-router';
|
||||
|
||||
import CreateItemPage from '@/pages/CreateItemPage';
|
||||
import DatabaseSchemaPage from '@/pages/DatabaseSchemaPage';
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { RouterProvider } from 'react-router-dom';
|
||||
import { RouterProvider } from 'react-router';
|
||||
|
||||
import { Router } from './Router';
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { Link } from 'react-router-dom';
|
||||
import { Link } from 'react-router';
|
||||
|
||||
interface TextURLProps {
|
||||
/** Text to display. */
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
'use client';
|
||||
|
||||
import { createContext, useCallback, useContext, useEffect, useState } from 'react';
|
||||
import { useLocation, useNavigate } from 'react-router-dom';
|
||||
import { useLocation, useNavigate } from 'react-router';
|
||||
|
||||
import { globals } from '@/utils/constants';
|
||||
import { contextOutsideScope } from '@/utils/labels';
|
||||
|
@ -54,7 +54,7 @@ export const NavigationState = ({ children }: React.PropsWithChildren) => {
|
|||
}
|
||||
if (validate()) {
|
||||
scrollTop();
|
||||
router(path);
|
||||
Promise.resolve(router(path)).catch(console.log);
|
||||
setIsBlocked(false);
|
||||
}
|
||||
},
|
||||
|
@ -65,7 +65,7 @@ export const NavigationState = ({ children }: React.PropsWithChildren) => {
|
|||
(path: string) => {
|
||||
if (validate()) {
|
||||
scrollTop();
|
||||
router(path, { replace: true });
|
||||
Promise.resolve(router(path, { replace: true })).catch(console.log);
|
||||
setIsBlocked(false);
|
||||
}
|
||||
},
|
||||
|
@ -75,7 +75,7 @@ export const NavigationState = ({ children }: React.PropsWithChildren) => {
|
|||
const back = useCallback(() => {
|
||||
if (validate()) {
|
||||
scrollTop();
|
||||
router(-1);
|
||||
Promise.resolve(router(-1)).catch(console.log);
|
||||
setIsBlocked(false);
|
||||
}
|
||||
}, [router, validate, scrollTop]);
|
||||
|
@ -83,7 +83,7 @@ export const NavigationState = ({ children }: React.PropsWithChildren) => {
|
|||
const forward = useCallback(() => {
|
||||
if (validate()) {
|
||||
scrollTop();
|
||||
router(1);
|
||||
Promise.resolve(router(1)).catch(console.log);
|
||||
setIsBlocked(false);
|
||||
}
|
||||
}, [router, validate, scrollTop]);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
'use client';
|
||||
|
||||
import { useLocation } from 'react-router-dom';
|
||||
import { useLocation } from 'react-router';
|
||||
|
||||
function useQueryStrings() {
|
||||
const search = useLocation().search;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
'use client';
|
||||
|
||||
import { useParams } from 'react-router-dom';
|
||||
import { useParams } from 'react-router';
|
||||
|
||||
import { AccessModeState } from '@/context/AccessModeContext';
|
||||
import { OssState } from '@/context/OssContext';
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
'use client';
|
||||
|
||||
import { useParams } from 'react-router-dom';
|
||||
import { useParams } from 'react-router';
|
||||
|
||||
import { AccessModeState } from '@/context/AccessModeContext';
|
||||
import { RSFormState } from '@/context/RSFormContext';
|
||||
|
|
|
@ -5,7 +5,7 @@ import { defineConfig, loadEnv, PluginOption } from 'vite';
|
|||
import { dependencies } from './package.json';
|
||||
|
||||
// Packages to include in main app bundle
|
||||
const inlinePackages = ['react', 'react-router-dom', 'react-dom'];
|
||||
const inlinePackages = ['react', 'react-router', 'react-dom'];
|
||||
|
||||
// Rollup warnings that should not be displayed
|
||||
const warningsToIgnore = [['SOURCEMAP_ERROR', "Can't resolve original location of error"]];
|
||||
|
|
Loading…
Reference in New Issue
Block a user