mirror of
https://github.com/bulwarkmail/webmail.git
synced 2026-10-31 16:13:15 +00:00
The Files store was the only account-scoped store never wired into the account lifecycle: account-state-manager clears email/contacts/calendar/ filter/identity/vacation on a switch, but not files. Because the Files store is a global that outlives the FilesApp component, the previous account's client + resources lingered in memory and resurfaced whenever the drive was reopened after a switch - most visibly when the switch happened on the mail view (FilesApp unmounted), the common normal-shell flow that the FilesApp re-init effect alone does not cover. Clear the Files store centrally in clearAllStores() alongside the other account-scoped stores, so the reset happens on every switch path. Tests: - lib/__tests__/account-state-manager.test.ts: assert clearAllStores() resets the Files drive (client, resources, pathStack, selection, supportsFiles) with no cross-account leak. - integration/tests/13-files-account-switch.spec.ts (dockerized Stalwart, JMAP FileNode): seeds a distinct top-level folder in alice's and bob's drives and asserts the on-screen drive swaps on a switch with no stale folder - both switching off the Files view (mail -> switch -> open Files) and on it (rail account switcher). Verified: passes with the fix, fails (path 1) without it. New FileNode seeding helpers in helpers/jmap.ts; openFiles/openMailView/driveEntry nav helpers in helpers/app.ts.