Skip to content

fix(preview): capture screenshots from hidden tabs - #172

Merged
incognitojam merged 1 commit into
mainfrom
t3code/fix-preview-tab-visibility
Aug 16, 2026
Merged

fix(preview): capture screenshots from hidden tabs#172
incognitojam merged 1 commit into
mainfrom
t3code/fix-preview-tab-visibility

Conversation

@incognitojam

Copy link
Copy Markdown
Collaborator

Summary

Background preview tabs remain parked far outside the Electron compositor. Their DOM automation stays available, but WebContents.capturePage() can reject with UnknownVizError or 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.ts
  • vp run --filter @t3tools/web typecheck
  • vp run --filter @t3tools/desktop typecheck
  • Targeted lint for all changed files
  • Electron 41.5.0 compositor probe: five parked-to-leased captures returned non-empty 1600x1200 images in 5-76 ms
  • Dev desktop MCP verification: visible capture succeeded; two fresh open: false tabs stayed visible: false before and after valid 1280x800 PNG snapshots; fresh open: true, show: true background tabs also captured successfully

Written by an agent (T3 Code, gpt-5.6-sol).

@incognitojam
incognitojam merged commit 043ff70 into main Aug 16, 2026
9 checks passed
@incognitojam
incognitojam deleted the t3code/fix-preview-tab-visibility branch August 16, 2026 13:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant