From 5615704f5e8540783b95f976047fb30c835eb7ce Mon Sep 17 00:00:00 2001 From: Linus Rath <139418639+rathlinus@users.noreply.github.com> Date: Wed, 14 Oct 2026 06:18:19 +0200 Subject: [PATCH] fix: start plugins on every page, not only after the mail view opened --- components/__tests__/plugin-app-events.test.tsx | 11 ++++++++++- components/providers/plugin-app-events.tsx | 8 ++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/components/__tests__/plugin-app-events.test.tsx b/components/__tests__/plugin-app-events.test.tsx index 6faf67ff3..75790e086 100644 --- a/components/__tests__/plugin-app-events.test.tsx +++ b/components/__tests__/plugin-app-events.test.tsx @@ -18,7 +18,7 @@ function listen unkn beforeEach(() => { clearAllHooks(); pathname = '/'; - usePluginStore.setState({ initialized: false }); + usePluginStore.setState({ initialized: false, initializePlugins: vi.fn().mockResolvedValue(undefined) }); useAuthStore.setState({ isAuthenticated: false }); }); afterEach(() => { @@ -74,6 +74,15 @@ describe('app events for plugins', () => { expect(ready).toHaveBeenCalledTimes(1); }); + it('starts the plugins once the user is signed in, on any page', () => { + render(); + expect(usePluginStore.getState().initializePlugins).not.toHaveBeenCalled(); + + act(() => { useAuthStore.setState({ isAuthenticated: true }); }); + + expect(usePluginStore.getState().initializePlugins).toHaveBeenCalledTimes(1); + }); + it('reports navigation between pages', () => { const navigate = listen(routerHooks.onNavigate); const { rerender } = render(); diff --git a/components/providers/plugin-app-events.tsx b/components/providers/plugin-app-events.tsx index 85592bf50..f16b5146d 100644 --- a/components/providers/plugin-app-events.tsx +++ b/components/providers/plugin-app-events.tsx @@ -122,6 +122,14 @@ export function PluginAppEvents() { // plugins have been started, so every plugin enabled at start hears it. const pluginsReady = usePluginStore((s) => s.initialized); const signedIn = useAuthStore((s) => s.isAuthenticated); + + // Start the plugins on whichever page the user lands on. They used to start + // only from the mail view, so a plugin's sidebar entry, page or reminders + // were missing on Calendar, Contacts, Files or Settings opened directly. + useEffect(() => { + if (signedIn) void usePluginStore.getState().initializePlugins(); + }, [signedIn]); + const readyFired = useRef(false); useEffect(() => { if (readyFired.current || !pluginsReady || !signedIn) return;