diff --git a/src/hooks/tests/useDashboardConfig.test.ts b/src/hooks/tests/useDashboardConfig.test.ts index 4aeb41e..b1b4da7 100644 --- a/src/hooks/tests/useDashboardConfig.test.ts +++ b/src/hooks/tests/useDashboardConfig.test.ts @@ -199,12 +199,11 @@ describe('useDashboardConfig', () => { }); expect(result.current.isLoaded).toBe(true); - expect(mockAddNotification).toHaveBeenCalledWith( - expect.objectContaining({ - variant: 'danger', - title: 'Failed to fetch dashboard template', - }) - ); + expect(mockAddNotification).toHaveBeenCalledWith({ + variant: 'warning', + title: 'No homepage dashboard set', + description: 'Set a dashboard as your homepage in the Dashboard Hub, or create a new one.', + }); consoleSpy.mockRestore(); }); diff --git a/src/hooks/useDashboardConfig.ts b/src/hooks/useDashboardConfig.ts index f265d02..c5ad2b7 100644 --- a/src/hooks/useDashboardConfig.ts +++ b/src/hooks/useDashboardConfig.ts @@ -70,11 +70,19 @@ const useDashboardConfig = (layoutType: LayoutTypes = 'landing-landingPage') => }) .catch((err) => { console.error(err); - addNotification({ - variant: 'danger', - title: 'Failed to fetch dashboard template', - description: 'Try reloading the page.', - }); + if (err instanceof Error && err.message === 'No custom default template found') { + addNotification({ + variant: 'warning', + title: 'No homepage dashboard set', + description: 'Set a dashboard as your homepage in the Dashboard Hub, or create a new one.', + }); + } else { + addNotification({ + variant: 'danger', + title: 'Failed to fetch dashboard template', + description: 'Try reloading the page.', + }); + } }) .finally(() => { setIsLoaded(true);