Skip to content

Commit

Permalink
perf(platform): use React.memo render routes
Browse files Browse the repository at this point in the history
  • Loading branch information
xiejay97 committed Nov 21, 2022
1 parent f695966 commit 75a332d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/platform/src/app/Routes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export interface NonIndexRouteItem extends Omit<NonIndexRouteObject, 'children'>
export type RouteItem = IndexRouteItem | NonIndexRouteItem;

// I have a great implementation of route caching, but considering the synchronization of data between pages (like modifying list or detail page data), I ended up not introducing route caching.
export function AppRoutes() {
export const AppRoutes = React.memo(() => {
const ACLGuard = useACLGuard();
const tokenGuard = useTokenGuard();
const location = useLocation();
Expand Down Expand Up @@ -218,4 +218,4 @@ export function AppRoutes() {
{element}
</RouteStateContext.Provider>
);
}
});

0 comments on commit 75a332d

Please sign in to comment.