fix(web): retry rejected route modules
This commit is contained in:
@@ -82,6 +82,10 @@ function loadRoute(section: RouteSection) {
|
||||
return next;
|
||||
}
|
||||
|
||||
export function createRouteComponent(section: RouteSection) {
|
||||
return lazy(() => loadRoute(section));
|
||||
}
|
||||
|
||||
export function routeSectionForPath(pathname: string): RouteSection | undefined {
|
||||
const section = pathname.split('?')[0].split('#')[0].split('/').filter(Boolean)[0] as RouteSection | undefined;
|
||||
return section && section in importers ? section : undefined;
|
||||
@@ -184,12 +188,23 @@ export function scheduleIdleRoutePreloads({
|
||||
}
|
||||
|
||||
export const RoutePages = {
|
||||
Monitor: lazy(() => loadRoute('monitor')),
|
||||
Vehicles: lazy(() => loadRoute('vehicles')),
|
||||
Tracks: lazy(() => loadRoute('tracks')),
|
||||
History: lazy(() => loadRoute('history')),
|
||||
Statistics: lazy(() => loadRoute('statistics')),
|
||||
Access: lazy(() => loadRoute('access')),
|
||||
Alerts: lazy(() => loadRoute('alerts')),
|
||||
Operations: lazy(() => loadRoute('operations'))
|
||||
Monitor: createRouteComponent('monitor'),
|
||||
Vehicles: createRouteComponent('vehicles'),
|
||||
Tracks: createRouteComponent('tracks'),
|
||||
History: createRouteComponent('history'),
|
||||
Statistics: createRouteComponent('statistics'),
|
||||
Access: createRouteComponent('access'),
|
||||
Alerts: createRouteComponent('alerts'),
|
||||
Operations: createRouteComponent('operations')
|
||||
} as const;
|
||||
|
||||
export const RoutePageFactories = {
|
||||
Monitor: () => createRouteComponent('monitor'),
|
||||
Vehicles: () => createRouteComponent('vehicles'),
|
||||
Tracks: () => createRouteComponent('tracks'),
|
||||
History: () => createRouteComponent('history'),
|
||||
Statistics: () => createRouteComponent('statistics'),
|
||||
Access: () => createRouteComponent('access'),
|
||||
Alerts: () => createRouteComponent('alerts'),
|
||||
Operations: () => createRouteComponent('operations')
|
||||
} as const;
|
||||
|
||||
Reference in New Issue
Block a user