diff --git a/src/apps/experimental/routes/routes.tsx b/src/apps/experimental/routes/routes.tsx
index c9e32899dc..b771df2581 100644
--- a/src/apps/experimental/routes/routes.tsx
+++ b/src/apps/experimental/routes/routes.tsx
@@ -8,8 +8,6 @@ import { toViewManagerPageRoute } from 'components/router/LegacyRoute';
import { toRedirectRoute } from 'components/router/Redirect';
import ErrorBoundary from 'components/router/ErrorBoundary';
-import AppLayout from '../AppLayout';
-
import { ASYNC_USER_ROUTES } from './asyncRoutes';
import { LEGACY_PUBLIC_ROUTES, LEGACY_USER_ROUTES } from './legacyRoutes';
import VideoPage from './video';
@@ -17,7 +15,7 @@ import VideoPage from './video';
export const EXPERIMENTAL_APP_ROUTES: RouteObject[] = [
{
path: '/*',
- element:
,
+ lazy: () => import('../AppLayout'),
children: [
{
/* User routes: Any child route of this layout is authenticated */
diff --git a/src/apps/stable/AppRouter.tsx b/src/apps/stable/AppRouter.tsx
deleted file mode 100644
index 40b5c2aa39..0000000000
--- a/src/apps/stable/AppRouter.tsx
+++ /dev/null
@@ -1,43 +0,0 @@
-import { History } from '@remix-run/router';
-import React from 'react';
-import { Outlet, RouterProvider, createHashRouter, useLocation } from 'react-router-dom';
-
-import { useLegacyRouterSync } from 'hooks/useLegacyRouterSync';
-import { STABLE_APP_ROUTES } from './routes/routes';
-import Backdrop from 'components/Backdrop';
-import AppHeader from 'components/AppHeader';
-import { DASHBOARD_APP_PATHS, DASHBOARD_APP_ROUTES } from 'apps/dashboard/routes/routes';
-import UserThemeProvider from 'themes/UserThemeProvider';
-
-const router = createHashRouter([{
- element:
,
- children: [
- ...STABLE_APP_ROUTES,
- ...DASHBOARD_APP_ROUTES
- ]
-}]);
-
-export default function StableAppRouter({ history }: Readonly<{ history: History }>) {
- useLegacyRouterSync({ router, history });
-
- return
;
-}
-
-/**
- * Layout component that renders legacy components required on all pages.
- * NOTE: The app will crash if these get removed from the DOM.
- */
-function StableAppLayout() {
- const location = useLocation();
- const isNewLayoutPath = Object.values(DASHBOARD_APP_PATHS)
- .some(path => location.pathname.startsWith(`/${path}`));
-
- return (
-
-
-
-
-
-
- );
-}
diff --git a/src/apps/stable/routes/routes.tsx b/src/apps/stable/routes/routes.tsx
index e5f800d20b..0eecd6b12d 100644
--- a/src/apps/stable/routes/routes.tsx
+++ b/src/apps/stable/routes/routes.tsx
@@ -16,7 +16,7 @@ import { LEGACY_PUBLIC_ROUTES, LEGACY_USER_ROUTES } from './legacyRoutes';
export const STABLE_APP_ROUTES: RouteObject[] = [
{
path: '/*',
- element:
,
+ Component: AppLayout,
children: [
{
/* User routes */
diff --git a/src/components/router/AsyncRoute.tsx b/src/components/router/AsyncRoute.tsx
index 34684d47ec..80e393d134 100644
--- a/src/components/router/AsyncRoute.tsx
+++ b/src/components/router/AsyncRoute.tsx
@@ -16,8 +16,6 @@ export interface AsyncRoute {
page?: string
/** The page type used to load the correct page element. */
type?: AsyncRouteType
- /** Override for pages that don't support lazy importing */
- Component?: React.ComponentType | null;
}
const importPage = (page: string, type: AsyncRouteType) => {
@@ -34,13 +32,8 @@ const importPage = (page: string, type: AsyncRouteType) => {
export const toAsyncPageRoute = ({
path,
page,
- Component,
type = AsyncRouteType.Stable
}: AsyncRoute): RouteObject => {
- if (Component) {
- return { path, Component };
- }
-
return {
path,
lazy: async () => {