Update react-router and add useTransition support

This commit is contained in:
jeffvli 2023-09-25 16:13:27 -07:00
parent f7cacd2b73
commit 3bbe696f4c
3 changed files with 36 additions and 37 deletions

58
package-lock.json generated
View File

@ -59,8 +59,8 @@
"react-i18next": "^11.16.7",
"react-icons": "^4.10.1",
"react-player": "^2.11.0",
"react-router": "^6.5.0",
"react-router-dom": "^6.5.0",
"react-router": "^6.16.0",
"react-router-dom": "^6.16.0",
"react-simple-img": "^3.0.0",
"react-virtualized-auto-sizer": "^1.0.17",
"react-window": "^1.8.9",
@ -4336,11 +4336,11 @@
}
},
"node_modules/@remix-run/router": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/@remix-run/router/-/router-1.1.0.tgz",
"integrity": "sha512-rGl+jH/7x1KBCQScz9p54p0dtPLNeKGb3e0wD2H5/oZj41bwQUnXdzbj2TbUAFhvD7cp9EyEQA4dEgpUFa1O7Q==",
"version": "1.9.0",
"resolved": "https://registry.npmjs.org/@remix-run/router/-/router-1.9.0.tgz",
"integrity": "sha512-bV63itrKBC0zdT27qYm6SDZHlkXwFL1xMBuhkn+X7l0+IIhNaH5wuuvZKp6eKhCD4KFhujhfhCT1YxXW6esUIA==",
"engines": {
"node": ">=14"
"node": ">=14.0.0"
}
},
"node_modules/@sindresorhus/is": {
@ -17055,29 +17055,29 @@
}
},
"node_modules/react-router": {
"version": "6.5.0",
"resolved": "https://registry.npmjs.org/react-router/-/react-router-6.5.0.tgz",
"integrity": "sha512-fqqUSU0NC0tSX0sZbyuxzuAzvGqbjiZItBQnyicWlOUmzhAU8YuLgRbaCL2hf3sJdtRy4LP/WBrWtARkMvdGPQ==",
"version": "6.16.0",
"resolved": "https://registry.npmjs.org/react-router/-/react-router-6.16.0.tgz",
"integrity": "sha512-VT4Mmc4jj5YyjpOi5jOf0I+TYzGpvzERy4ckNSvSh2RArv8LLoCxlsZ2D+tc7zgjxcY34oTz2hZaeX5RVprKqA==",
"dependencies": {
"@remix-run/router": "1.1.0"
"@remix-run/router": "1.9.0"
},
"engines": {
"node": ">=14"
"node": ">=14.0.0"
},
"peerDependencies": {
"react": ">=16.8"
}
},
"node_modules/react-router-dom": {
"version": "6.5.0",
"resolved": "https://registry.npmjs.org/react-router-dom/-/react-router-dom-6.5.0.tgz",
"integrity": "sha512-/XzRc5fq80gW1ctiIGilyKFZC/j4kfe75uivMsTChFbkvrK4ZrF3P3cGIc1f/SSkQ4JiJozPrf+AwUHHWVehVg==",
"version": "6.16.0",
"resolved": "https://registry.npmjs.org/react-router-dom/-/react-router-dom-6.16.0.tgz",
"integrity": "sha512-aTfBLv3mk/gaKLxgRDUPbPw+s4Y/O+ma3rEN1u8EgEpLpPe6gNjIsWt9rxushMHHMb7mSwxRGdGlGdvmFsyPIg==",
"dependencies": {
"@remix-run/router": "1.1.0",
"react-router": "6.5.0"
"@remix-run/router": "1.9.0",
"react-router": "6.16.0"
},
"engines": {
"node": ">=14"
"node": ">=14.0.0"
},
"peerDependencies": {
"react": ">=16.8",
@ -24366,9 +24366,9 @@
}
},
"@remix-run/router": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/@remix-run/router/-/router-1.1.0.tgz",
"integrity": "sha512-rGl+jH/7x1KBCQScz9p54p0dtPLNeKGb3e0wD2H5/oZj41bwQUnXdzbj2TbUAFhvD7cp9EyEQA4dEgpUFa1O7Q=="
"version": "1.9.0",
"resolved": "https://registry.npmjs.org/@remix-run/router/-/router-1.9.0.tgz",
"integrity": "sha512-bV63itrKBC0zdT27qYm6SDZHlkXwFL1xMBuhkn+X7l0+IIhNaH5wuuvZKp6eKhCD4KFhujhfhCT1YxXW6esUIA=="
},
"@sindresorhus/is": {
"version": "4.6.0",
@ -33977,20 +33977,20 @@
}
},
"react-router": {
"version": "6.5.0",
"resolved": "https://registry.npmjs.org/react-router/-/react-router-6.5.0.tgz",
"integrity": "sha512-fqqUSU0NC0tSX0sZbyuxzuAzvGqbjiZItBQnyicWlOUmzhAU8YuLgRbaCL2hf3sJdtRy4LP/WBrWtARkMvdGPQ==",
"version": "6.16.0",
"resolved": "https://registry.npmjs.org/react-router/-/react-router-6.16.0.tgz",
"integrity": "sha512-VT4Mmc4jj5YyjpOi5jOf0I+TYzGpvzERy4ckNSvSh2RArv8LLoCxlsZ2D+tc7zgjxcY34oTz2hZaeX5RVprKqA==",
"requires": {
"@remix-run/router": "1.1.0"
"@remix-run/router": "1.9.0"
}
},
"react-router-dom": {
"version": "6.5.0",
"resolved": "https://registry.npmjs.org/react-router-dom/-/react-router-dom-6.5.0.tgz",
"integrity": "sha512-/XzRc5fq80gW1ctiIGilyKFZC/j4kfe75uivMsTChFbkvrK4ZrF3P3cGIc1f/SSkQ4JiJozPrf+AwUHHWVehVg==",
"version": "6.16.0",
"resolved": "https://registry.npmjs.org/react-router-dom/-/react-router-dom-6.16.0.tgz",
"integrity": "sha512-aTfBLv3mk/gaKLxgRDUPbPw+s4Y/O+ma3rEN1u8EgEpLpPe6gNjIsWt9rxushMHHMb7mSwxRGdGlGdvmFsyPIg==",
"requires": {
"@remix-run/router": "1.1.0",
"react-router": "6.5.0"
"@remix-run/router": "1.9.0",
"react-router": "6.16.0"
}
},
"react-shallow-renderer": {

View File

@ -305,8 +305,8 @@
"react-i18next": "^11.16.7",
"react-icons": "^4.10.1",
"react-player": "^2.11.0",
"react-router": "^6.5.0",
"react-router-dom": "^6.5.0",
"react-router": "^6.16.0",
"react-router-dom": "^6.16.0",
"react-simple-img": "^3.0.0",
"react-virtualized-auto-sizer": "^1.0.17",
"react-window": "^1.8.9",

View File

@ -1,10 +1,8 @@
import isElectron from 'is-electron';
import { lazy, Suspense } from 'react';
import {
Route,
createRoutesFromElements,
RouterProvider,
createBrowserRouter,
createHashRouter,
} from 'react-router-dom';
import { AppRoute } from './routes';
@ -68,10 +66,8 @@ const RouteErrorBoundary = lazy(
() => import('/@/renderer/features/action-required/components/route-error-boundary'),
);
const dynamicRouter = isElectron() ? createHashRouter : createBrowserRouter;
export const AppRouter = () => {
const router = dynamicRouter(
const router = createHashRouter(
createRoutesFromElements(
<>
<Route element={<TitlebarOutlet />}>
@ -198,7 +194,10 @@ export const AppRouter = () => {
return (
<Suspense fallback={<></>}>
<RouterProvider router={router} />
<RouterProvider
future={{ v7_startTransition: true }}
router={router}
/>
</Suspense>
);
};