perf(web): reschedule route preloads after navigation
This commit is contained in:
@@ -39,11 +39,11 @@ const pageNames: Record<string, string> = {
|
||||
|
||||
export function AppShell() {
|
||||
const location = useLocation();
|
||||
const [initialPathname] = useState(() => location.pathname);
|
||||
const section = location.pathname.split('/')[1] || 'monitor';
|
||||
const activeRoutePath = `/${section}`;
|
||||
const { session, logout } = usePlatformSession();
|
||||
const roleLabel = { viewer: '只读', operator: '处置员', admin: '管理员' }[session.role];
|
||||
useEffect(() => scheduleIdleRoutePreloads({ activePathname: initialPathname }), [initialPathname]);
|
||||
useEffect(() => scheduleIdleRoutePreloads({ activePathname: activeRoutePath }), [activeRoutePath]);
|
||||
|
||||
return (
|
||||
<div className="v2-shell">
|
||||
|
||||
Reference in New Issue
Block a user