diff --git a/src/components/Page.tsx b/src/components/Page.tsx index c3dacd8383..6787e8f545 100644 --- a/src/components/Page.tsx +++ b/src/components/Page.tsx @@ -1,4 +1,4 @@ -import React, { type FC, type PropsWithChildren, type HTMLAttributes, useEffect, useRef } from 'react'; +import React, { type FC, type PropsWithChildren, type HTMLAttributes, useEffect, useRef, StrictMode } from 'react'; import viewManager from './viewManager/viewManager'; @@ -57,18 +57,20 @@ const Page: FC>> = }, [ element, isNowPlayingBarEnabled, isThemeMediaSupported ]); return ( -
- {children} -
+ +
+ {children} +
+
); }; diff --git a/src/components/router/AsyncRoute.tsx b/src/components/router/AsyncRoute.tsx index 7113478861..f63e49276a 100644 --- a/src/components/router/AsyncRoute.tsx +++ b/src/components/router/AsyncRoute.tsx @@ -1,4 +1,3 @@ -import React, { StrictMode } from 'react'; import type { RouteObject } from 'react-router-dom'; export enum AsyncRouteType { @@ -19,7 +18,7 @@ export interface AsyncRoute { type?: AsyncRouteType } -const importPage = (page: string, type: AsyncRouteType) => { +const importRoute = (page: string, type: AsyncRouteType) => { switch (type) { case AsyncRouteType.Dashboard: return import(/* webpackChunkName: "[request]" */ `../../apps/dashboard/routes/${page}`); @@ -38,14 +37,16 @@ export const toAsyncPageRoute = ({ return { path, lazy: async () => { - const { default: Page } = await importPage(page ?? path, type); - return { - element: ( - - - - ) - }; + const { default: route } = await importRoute(page ?? path, type); + + // If route is not a RouteObject, use it as the Component + if (!route.Component) { + return { + Component: route + }; + } + + return route; } }; };