fix(desktop): stop hidden previews draining battery #8567
MergedBil0000(GitHub profile, opens in a new tab)merged 2 commits into
main fromrefs/pull/8567/headmerged by juliusmarminge View on GitHubgithub-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:trusted
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:M
- apps/web/src/browser/hostedBrowserWebviewStyle.ts line 48Resolvedby Bil0000(GitHub profile, opens in a new tab)@@ -44,7 +45,4 @@4445 height: hiddenSize.height,4546 zIndex: -1,4647 pointerEvents: "none",47- // Keep the guest CSS-visible even while physically offscreen. Electron48- // webviews can keep metadata/status alive under `visibility:hidden` while49- // CDP Runtime/Input commands stall, which breaks offscreen automation.50- visibility: "visible",48+ visibility: renderingActive ? "visible" : "hidden",
- apps/web/src/components/preview/PreviewAutomationHosts.tsx lines 127 to 130Resolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -121,3 +124,7 @@121124 (candidate) => candidate.getAttribute("data-preview-tab") === tabId,122125 ) ?? null;123126127+const isPreviewWebviewRendering = (runtimeTabId: string): boolean => {128+ const wrapper = findPreviewWebview(runtimeTabId)?.closest<HTMLElement>("[data-preview-viewport]");129+ return wrapper !== null && wrapper !== undefined && wrapper.style.visibility !== "hidden";130+};apps/web/src/browser/hostedBrowserWebviewStyle.ts lines 48 to 48Resolvedby Bil0000(GitHub profile, opens in a new tab)@@ -44,7 +45,4 @@4445 height: hiddenSize.height,4546 zIndex: -1,4647 pointerEvents: "none",47- // Keep the guest CSS-visible even while physically offscreen. Electron48- // webviews can keep metadata/status alive under `visibility:hidden` while49- // CDP Runtime/Input commands stall, which breaks offscreen automation.50- visibility: "visible",48+ visibility: renderingActive ? "visible" : "hidden",
juliusmarminge merged thisff17610
juliusmarminge closed this
Sign in to join this conversation.
Important
Review skipped#
Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the
.coderabbit.yamlfile in this repository. To trigger a single review, invoke the@coderabbitai reviewcommand.⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID:
6e6dc94b-00c1-444e-be5f-1075380b53afYou can disable this status message by setting the
reviews.review_statustofalsein the CodeRabbit configuration file.Use the checkbox below for a quick retry:
Comment `@coderabbitai help` to get the list of available commands.