Skip to content

Commit cd53061

Browse files
committed
fix(web): expose preview rendering state
1 parent 68d91f0 commit cd53061

2 files changed

Lines changed: 4 additions & 2 deletions

File tree

‎apps/web/src/browser/HostedBrowserWebview.tsx‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,9 +238,10 @@ export function HostedBrowserWebview(props: {
238238

239239
if (!config) return null;
240240

241+
const renderingActive = active || backgroundActivity || pictureInPicture || recordingActive;
241242
const wrapperStyle = resolveHostedBrowserWebviewWrapperStyle({
242243
active,
243-
renderingActive: active || backgroundActivity || pictureInPicture || recordingActive,
244+
renderingActive,
244245
cornerRadius: presentation.cornerRadius,
245246
rect: lastRect,
246247
hiddenSize,
@@ -252,6 +253,7 @@ export function HostedBrowserWebview(props: {
252253
className="fixed overflow-hidden bg-muted/35"
253254
style={{ ...wrapperStyle, overscrollBehavior: "contain" }}
254255
onScroll={syncContentPresentation}
256+
data-preview-rendering={renderingActive ? "active" : "suspended"}
255257
data-preview-viewport={runtimeTabId}
256258
>
257259
<div className="relative" style={{ width: layout.canvasWidth, height: layout.canvasHeight }}>

‎apps/web/src/components/preview/PreviewAutomationHosts.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ const findPreviewWebview = (tabId: string): ExecutablePreviewWebview | null =>
126126

127127
const isPreviewWebviewRendering = (runtimeTabId: string): boolean => {
128128
const wrapper = findPreviewWebview(runtimeTabId)?.closest<HTMLElement>("[data-preview-viewport]");
129-
return wrapper !== null && wrapper !== undefined && wrapper.style.visibility !== "hidden";
129+
return wrapper?.getAttribute("data-preview-rendering") === "active";
130130
};
131131

132132
const readWebviewViewport = async (

0 commit comments

Comments
 (0)