diff --git a/public/app/routes/routes.tsx b/public/app/routes/routes.tsx index 35ecd371283..8f8b482fb47 100644 --- a/public/app/routes/routes.tsx +++ b/public/app/routes/routes.tsx @@ -27,10 +27,12 @@ const isDevEnv = config.buildInfo.env === 'development'; export const extraRoutes: RouteDescriptor[] = []; export function getAppRoutes(): RouteDescriptor[] { + const appPluginRoutes = getAppPluginRoutes(); + return [ // Based on the Grafana configuration standalone plugin pages can even override and extend existing core pages, or they can register new routes under existing ones. // In order to make it possible we need to register them first due to how `` is evaluating routes. (This will be unnecessary once/when we upgrade to React Router v6 and start using `` instead.) - ...getAppPluginRoutes(), + ...appPluginRoutes, { path: '/', pageClass: 'page-dashboard', @@ -522,7 +524,8 @@ export function getAppRoutes(): RouteDescriptor[] { config.featureToggles.exploreMetrics && { path: '/explore/metrics/*', roles: () => contextSrv.evaluatePermission([AccessControlAction.DataSourcesExplore]), - ...(config.featureToggles.exploreMetricsUseExternalAppPlugin + ...(config.featureToggles.exploreMetricsUseExternalAppPlugin && + Boolean(appPluginRoutes.find(({ path }) => path === '/a/grafana-metricsdrilldown-app/*')) ? { component: SafeDynamicImport( () =>