From 3bbe696f4c9520492b3258d12cc082dbf451162d Mon Sep 17 00:00:00 2001 From: jeffvli Date: Mon, 25 Sep 2023 16:13:27 -0700 Subject: [PATCH] Update react-router and add useTransition support --- package-lock.json | 58 +++++++++++++++--------------- package.json | 4 +-- src/renderer/router/app-router.tsx | 11 +++--- 3 files changed, 36 insertions(+), 37 deletions(-) diff --git a/package-lock.json b/package-lock.json index 2f4516d5..898e470b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -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": { diff --git a/package.json b/package.json index 9e53cda2..aa621d67 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/src/renderer/router/app-router.tsx b/src/renderer/router/app-router.tsx index 55e02e46..41cbc628 100644 --- a/src/renderer/router/app-router.tsx +++ b/src/renderer/router/app-router.tsx @@ -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( <> }> @@ -198,7 +194,10 @@ export const AppRouter = () => { return ( }> - + ); };