fix(settings): the offline language mirror does not outlive the account (#2146)

The mirror of the account language stayed in localStorage past logout, so the next account on the device booted in the previous user's language forever. It is cleared on logout and rewritten on login, and the rate-limit message follows the same order the boot language does.
This commit is contained in:
Maurice
2026-09-02 19:00:49 +02:00
committed by Maurice
parent 7c857173cf
commit a5d87d295a
5 changed files with 83 additions and 6 deletions
@@ -759,4 +759,20 @@ describe('authStore', () => {
expect(syncTriggers.registerSyncTriggers).toHaveBeenCalled();
});
});
// The mirror of the account's server-side language is a per-device copy like the
// appearance snapshot and the startup destination, and gets dropped with them.
// 'app_language' is not a mirror but this device's own choice, so it stays.
describe('FE-STORE-AUTH-034: logout drops the language mirror', () => {
it('clears the account language but keeps an explicit in-app choice', async () => {
localStorage.setItem('app_language_server', 'ja');
localStorage.setItem('app_language', 'de');
useAuthStore.setState({ user: buildUser(), isAuthenticated: true });
await useAuthStore.getState().logout();
expect(localStorage.getItem('app_language_server')).toBeNull();
expect(localStorage.getItem('app_language')).toBe('de');
});
});
});