diff --git a/public/app/features/plugins/components/AppRootPage.test.tsx b/public/app/features/plugins/components/AppRootPage.test.tsx index 69f01e9dc37..4adc4b1e80c 100644 --- a/public/app/features/plugins/components/AppRootPage.test.tsx +++ b/public/app/features/plugins/components/AppRootPage.test.tsx @@ -103,9 +103,12 @@ describe('AppRootPage', () => { }); it("should show a not found page if the plugin settings can't load", async () => { + jest.spyOn(console, 'error').mockImplementation(); getPluginSettingsMock.mockRejectedValue(new Error('Unknown Plugin')); // Renders once for the first time - await renderUnderRouter(); + await act(async () => { + await renderUnderRouter(); + }); expect(await screen.findByText('App not found')).toBeVisible(); }); diff --git a/public/app/features/plugins/components/AppRootPage.tsx b/public/app/features/plugins/components/AppRootPage.tsx index bd22739aa1a..f66d4531f03 100644 --- a/public/app/features/plugins/components/AppRootPage.tsx +++ b/public/app/features/plugins/components/AppRootPage.tsx @@ -13,7 +13,7 @@ import { PluginType, PluginContextProvider, } from '@grafana/data'; -import { config, locationSearchToObject } from '@grafana/runtime'; +import { config, locationSearchToObject, logError } from '@grafana/runtime'; import { Alert } from '@grafana/ui'; import { Page } from 'app/core/components/Page/Page'; import PageLoader from 'app/core/components/PageLoader/PageLoader'; @@ -21,6 +21,7 @@ import { EntityNotFound } from 'app/core/components/PageNotFound/EntityNotFound' import { useGrafana } from 'app/core/context/GrafanaContext'; import { appEvents, contextSrv } from 'app/core/core'; import { getNotFoundNav, getWarningNav, getExceptionNav } from 'app/core/navigation/errorModels'; +import { getMessageFromError } from 'app/core/utils/errors'; import { getPluginSettings } from '../pluginSettings'; import { importAppPlugin } from '../plugin_loader'; @@ -191,6 +192,9 @@ async function loadAppPlugin(pluginId: string, dispatch: React.Dispatch