Skip to content

Commit

Permalink
Update react-router and add useTransition support
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffvli committed Sep 25, 2023
1 parent f7cacd2 commit 3bbe696
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 37 deletions.
58 changes: 29 additions & 29 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
11 changes: 5 additions & 6 deletions src/renderer/router/app-router.tsx
Original file line number Diff line number Diff line change
@@ -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';
Expand Down Expand Up @@ -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 />}>
Expand Down Expand Up @@ -198,7 +194,10 @@ export const AppRouter = () => {

return (
<Suspense fallback={<></>}>
<RouterProvider router={router} />
<RouterProvider
future={{ v7_startTransition: true }}
router={router}
/>
</Suspense>
);
};

1 comment on commit 3bbe696

@vercel
Copy link

@vercel vercel bot commented on 3bbe696 Sep 25, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

feishin – ./

feishin-git-development-jeffvli.vercel.app
feishin.vercel.app
feishin-jeffvli.vercel.app

Please sign in to comment.