Skip to content

Keep account lookup, knowledge base selection, and sign-out working when browser storage is blocked. - #1563

Merged
WaylandYang merged 3 commits into
deeplethe:devfrom
virtue039:fix/web-session-when-local-storage-is-blocked
Dec 2, 2026
Merged

WaylandYang merged 3 commits into
deeplethe:devfrom
virtue039:fix/web-session-when-local-storage-is-blocked

Conversation

@virtue039

@virtue039 virtue039 commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor

Why

A browser can throw SecurityError when 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.

  • The local review revision on top of d61ab21 passed all 359 frontend tests on macOS arm64 and passed pnpm exec tsc --noEmit.

Before review

  • The published commit is signed off under the DCO.

Signed-off-by: Virtue039 <77153652+virtue039@users.noreply.github.com>
@WaylandYang

Copy link
Copy Markdown
Contributor

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. Chat.tsx still calls sessionStorage directly (the draft in the useState initializer, plus the lastKey reads and writes), so the chat page still throws when both are blocked. Could you either route those through the same helper (exporting withSessionStorage, say), or narrow the test name and description to account lookup, knowledge-base selection and sign-out?

@virtue039

Copy link
Copy Markdown
Contributor Author

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>
@virtue039 virtue039 changed the title Keep signed-in navigation working when local storage is blocked. Keep account lookup, knowledge base selection, and sign-out working when browser storage is blocked. Dec 2, 2026

@WaylandYang WaylandYang left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, the test name and description now match what it covers.

@WaylandYang
WaylandYang merged commit 1f6ca26 into deeplethe:dev Dec 2, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants