Field notes
Signing out is not the only identity boundary. An application also needs to replace account-owned state when two signed-in users switch directly, or when a guest becomes an authenticated user.
List every identity transition
A cache that clears only when a guest signs in can survive a direct switch between accounts. In our desktop pronunciation work, a global transcription cache could retain behavior from a previous subscription tier. The underlying problem was ownership: the cache was treated as application-wide even though its contents depended on the current user.
Make the owner part of the state model
Associate cached data with a stable account identity, or an explicit guest identity. When that identity changes, clear or replace the corresponding local state before using it for the next person. Do not use a display name as an owner key. Keep server-side authorization independent; clearing a local cache is not a substitute for checking access on the server.
Handle work that completes after the switch
A request started by the old account may finish after the new account is active. Before applying its result, check that the response still belongs to the current owner, or cancel the work when appropriate. Apply the same ownership decision to persisted data, query caches, UI selections and background jobs instead of fixing only the visible screen.
Test a matrix instead of one sign-out path
Use two deliberately different accounts and check the first screen after every transition. Exercise differing access levels and a response that arrives late. These tests should verify the current user’s data and permitted behavior, not merely that the sign-in dialog closed.
- Guest to account and account to guest
- Account A directly to account B
- Different subscription or permission levels
- A pending request that completes after switching
- A restart with persisted state from another owner
Sources and further reading
Have a problem in mind?
Tell us what you want to change. We’ll work out the next step together.