Preserve owned browser state across chat saves#3883
Merged
louis030195 merged 10 commits intoJun 8, 2026
Merged
Conversation
Anshgrover23
suggested changes
Jun 6, 2026
louis030195
reviewed
Jun 6, 2026
louis030195
left a comment
Collaborator
There was a problem hiding this comment.
@thisisharsh7 lgtm, tests look clean too
generated by the screenpipe pr-review pipe (https://screenpi.pe), not written by a human — reply and tag @louis030195 if it got something wrong.
Anshgrover23
suggested changes
Jun 6, 2026
Comment on lines
+95
to
+101
| export function markCachedBrowserStateCleared( | ||
| conversationId: string | null | undefined, | ||
| updatedAt = Date.now(), | ||
| ): void { | ||
| if (!conversationId) return; | ||
| writeRaw(storageKey(conversationId), JSON.stringify({ cleared: true, updatedAt })); | ||
| } |
Contributor
There was a problem hiding this comment.
@thisisharsh7 Do we clear these localStorage entries when a conversation is permanently deleted?
…t-saves' into preserve-browser-state-across-chat-saves
Contributor
Author
|
Updated -
|
Collaborator
|
how does this scale if user has 10k chats? |
Contributor
Author
It should be fine. This only touches browser state for the chat you're currently opening or saving not all chats.
|
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.
This PR preserves owned browser state across chat saves.
Before this change, the browser sidebar state could be lost if the browser opened before the conversation file existed, or if a later foreground/background chat save rewrote the conversation without keeping browserState.
This change adds a small per-conversation browser-state cache and makes both chat save paths preserve the latest browser state, so reopening a chat restores the browser sidebar more reliably.
Before -
Screen.Recording.2026-06-06.at.9.35.39.PM.mov
Screen.Recording.2026-06-07.at.6.51.36.AM.mov
After -
Screen.Recording.2026-06-06.at.9.30.03.PM.mov
Screen.Recording.2026-06-07.at.6.46.11.AM.mov