fix: clear stale preview URL from SQLite and prevent stale white screen on preview clear#2358
Open
dushyant-hada-90 wants to merge 1 commit into
Open
Conversation
453e9a0 to
28a4588
Compare
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.
Fixes #2352
Fixes #2347
Problem
When an agent deletes a workspace file that was previously auto-detected as a preview entry point (e.g.
index.html), the preview poller would returnok=falsefromDiscoverEntryand silently skip the session. Thepreview_urlin SQLite was never cleared, leaving a stale URL pointing at a file that no longer existed on disk.This caused two visible problems:
preview_url, showing a blank browser instead of the Summary tabVerified live against
ao.db— all four active dummy sessions had stalepreview_urlvalues with missing workspace files:Changes
Backend —
internal/preview/poller.goWhen
DiscoverEntryreturnsok=false, the poller now checks whether the session holds a workspace-scoped preview URL via the existingisWorkspacePreviewURLhelper. If so, it callsSetPreview(ctx, sess.ID, "")to clear the stale URL and deletes the session fromp.seenso the next poll re-evaluates it. Manually set dev server URLs (e.g.http://localhost:5173) are not affected.Frontend —
browser-view-host.tsThe
clear()handler now hides and moves theWebContentsViewoffscreen before navigating toabout:blank, preventing the white page from painting over the placeholder.clearHistory()is called after the navigate so the back button is correctly disabled after a clear.Frontend —
useBrowserView.tsAdded a
hasUrlRefguard tomeasureAndSendthat prevents therequestAnimationFramecallback from making the native view visible when there is no URL. Also tightened the positioning effect to require bothnavState.urlandactivebefore showing the view.Frontend —
SessionView.tsxAdded an effect that detects when
previewUrltransitions from set to empty (with an advancingpreviewRevision) and automatically switches the inspector to the Summary tab. Per-revision tracking ensures this fires exactly once per clear event.Testing
poller_test.go,useBrowserView.test.tsx,BrowserPanel.test.tsx, andbrowser-view-host.test.tsupdated and passingindex.html→ browser panel clears → inspector switches to Summary tab automatically