fix(preview): capture screenshots from hidden tabs - #172
Merged
Conversation
This was referenced Aug 16, 2026
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
Background preview tabs remain parked far outside the Electron compositor. Their DOM automation stays available, but
WebContents.capturePage()can reject withUnknownVizErroror never settle because the guest has no captureable surface.This change gives snapshot requests a short-lived, reference-counted compositor lease. Only the target webview moves in-window with
opacity: 0, the host waits for guest render frames, and the lease is always released after capture. Native snapshot capture is also bounded and single-flight so a stuck promise cannot start overlapping compositor copies.This is the screenshot portion of #170. Recording and preview visibility semantics remain separate follow-ups.
Testing
vp test run apps/desktop/src/preview/Manager.test.ts apps/web/src/browser/browserSurfaceStore.test.ts apps/web/src/browser/hostedBrowserWebviewStyle.test.tsvp run --filter @t3tools/web typecheckvp run --filter @t3tools/desktop typecheckopen: falsetabs stayedvisible: falsebefore and after valid 1280x800 PNG snapshots; freshopen: true, show: truebackground tabs also captured successfullyWritten by an agent (T3 Code, gpt-5.6-sol).