From 4866898529cb65b0b090b389dec41767d01160df Mon Sep 17 00:00:00 2001 From: Ashley Harrison Date: Fri, 9 Sep 2022 16:09:34 +0100 Subject: [PATCH] make sure AppRoot is lazily loaded (#54954) --- public/app/routes/routes.tsx | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/public/app/routes/routes.tsx b/public/app/routes/routes.tsx index f94273d3544..a99aab8a344 100644 --- a/public/app/routes/routes.tsx +++ b/public/app/routes/routes.tsx @@ -13,7 +13,6 @@ import { getRoutes as getDataConnectionsRoutes } from 'app/features/data-connect import { DATASOURCES_ROUTES } from 'app/features/datasources/constants'; import { getLiveRoutes } from 'app/features/live/pages/routes'; import { getRoutes as getPluginCatalogRoutes } from 'app/features/plugins/admin/routes'; -import AppRootPage from 'app/features/plugins/components/AppRootPage'; import { getProfileRoutes } from 'app/features/profile/routes'; import { ServiceAccountPage } from 'app/features/serviceaccounts/ServiceAccountPage'; import { AccessControlAction, DashboardRoutes } from 'app/types'; @@ -39,11 +38,14 @@ export function getAppRoutes(): RouteDescriptor[] { component: (props) => { const hasRoot = pluginHasRootPage(props.match.params.pluginId, config.bootData.navTree); const hasQueryParams = Object.keys(props.queryParams).length > 0; - return hasRoot || hasQueryParams ? ( - - ) : ( - - ); + if (hasRoot || hasQueryParams) { + const AppRootPage = SafeDynamicImport( + () => import(/* webpackChunkName: "AppRootPage" */ 'app/features/plugins/components/AppRootPage') + ); + return ; + } else { + return ; + } }, }, ]