fix(AGENT-675): add sessionStorage for multi-tab chat isolation#26
Open
diecoscai wants to merge 3 commits into
Open
fix(AGENT-675): add sessionStorage for multi-tab chat isolation#26diecoscai wants to merge 3 commits into
diecoscai wants to merge 3 commits into
Conversation
Use sessionStorage as primary store (tab-scoped) with localStorage as backup for returning users. On mount, prefer sessionStorage; fall back to localStorage and seed sessionStorage from it. Ratings and lead data write to both stores. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Author
Code Review — AGENT-675 sessionStorage tab isolationVerdict: ✅ Ready to merge — The core approach is correct and the three-commit arc on this branch shows good iteration. The implementation does what it claims. What's solid
Non-blocking nit —
|
Open
3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements AGENT-675 by making chat state tab-scoped with
sessionStorageas the primary store, while keepinglocalStoragefor compatibility/migration.Why this change
Users with multiple tabs were sharing the same
localStoragekey, which caused state collisions (for example, feedback and chat history crossing between tabs). This PR isolates active tab state to eliminate cross-tab contamination while preserving existing persisted behavior.What changed
1)
src/components/Bot.tsxsessionStorageas the primary source for active-tab chat state.localStoragewhen session data is missing (returning users/new tab).removeSessionStorageChatHistory+removeLocalStorageChatHistory).2)
src/components/bubbles/BotBubble.tsx3)
src/components/bubbles/LeadCaptureBubble.tsx4)
src/utils/index.tssetSessionStorageChatflowgetSessionStorageChatflowremoveSessionStorageChatHistoryleaddata when clearing session chat history (parity with local storage behavior).Behavior after this PR
Notes
Linear
Resolves AGENT-675