Repository navigation
Keep account lookup, knowledge base selection, and sign-out working when browser storage is blocked. - #1563
Conversation
Signed-off-by: Virtue039 <77153652+virtue039@users.noreply.github.com>
|
Thanks, the guarded storage access and the in-memory fallback look good. The test "keeps the current tab usable when both storage areas are blocked" claims more than the PR does, though. |
|
Thanks for pointing out the direct storage accesses in Chat.tsx. I’m narrowing the test name and PR description to account lookup, knowledge base selection, and sign-out with both storage areas blocked. The existing test also checks that a second lookup preserves the selection and signing out clears session state. |
Signed-off-by: Virtue039 <77153652+virtue039@users.noreply.github.com>
WaylandYang
left a comment
There was a problem hiding this comment.
Thanks, the test name and description now match what it covers.
Why
A browser can throw
SecurityErrorwhen a page accesses either storage area. Account lookup can then fail while recording the account that owns the session state. Sign-out can also stop before the page clears that state.What changes
Guard storage access during account lookup, workspace and knowledge base selection, and sign-out. When storage is blocked, remember the account in memory so a second lookup for the same account preserves the selected knowledge base. Sign-out clears the in-memory selection, account ownership, and query cache.
How it was checked
The regression makes both storage areas throw
SecurityError. It fetches the account, selects a knowledge base, fetches the same account again, and signs out. It checks that the selection survives the second lookup and that sign-out clears session state.d61ab21passed all 359 frontend tests on macOS arm64 and passedpnpm exec tsc --noEmit.Before review