Preserve authoritative account selection

This commit is contained in:
Eric Bailey
2026-08-31 14:20:02 -05:00
parent e59533b38a
commit f4aff44e8f
8 changed files with 83 additions and 2 deletions
+12
View File
@@ -104,6 +104,18 @@ If a queued stale refresh succeeds, its result is conditionally committed agains
Tabs must not publish complete in-memory session snapshots as authoritative state. Metadata updates should patch metadata onto a fresh localStorage read without touching credential fields.
Current-account selection is also explicit mutation intent, not a field inferred from an otherwise stale session snapshot. A commit preserves the current account read from localStorage unless the operation explicitly switches accounts. Login, account creation, and explicit resume/switch operations may select their target DID. Refreshes and metadata updates do not change the persisted selection. Logout, removal, and expiration begin from the persisted selection; the final credential-state validation clears it only if that selected account is no longer active.
For example:
```text
Tab A commits: current account Y
Tab B stale memory: current account X
Tab B updates: metadata or refreshed credentials for X
Tab B rereads: current account Y
Tab B commits: preserve current account Y
```
## 3. Commit refreshes conditionally
Start with both tabs and shared storage at the same credential generation: