mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
make sure AppRoot is lazily loaded (#54954)
This commit is contained in:
parent
1a285d2d0e
commit
4866898529
@ -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 ? (
|
||||
<AppRootPage {...props} />
|
||||
) : (
|
||||
<NavLandingPage navId={`plugin-page-${props.match.params.pluginId}`} />
|
||||
);
|
||||
if (hasRoot || hasQueryParams) {
|
||||
const AppRootPage = SafeDynamicImport(
|
||||
() => import(/* webpackChunkName: "AppRootPage" */ 'app/features/plugins/components/AppRootPage')
|
||||
);
|
||||
return <AppRootPage {...props} />;
|
||||
} else {
|
||||
return <NavLandingPage navId={`plugin-page-${props.match.params.pluginId}`} />;
|
||||
}
|
||||
},
|
||||
},
|
||||
]
|
||||
|
Loading…
Reference in New Issue
Block a user