diff --git a/src/canvas/workspace/WorkspaceView.tsx b/src/canvas/workspace/WorkspaceView.tsx index 3e1828f0c..c9f7807b4 100644 --- a/src/canvas/workspace/WorkspaceView.tsx +++ b/src/canvas/workspace/WorkspaceView.tsx @@ -366,13 +366,22 @@ export function WorkspaceView({ rt }: { rt: WorkspaceRuntime }) { const outputState = timelineOutput.state; const outputSource = outputState ? doc.nodes.find((node) => node.id === outputState.itemId) : undefined; const existingOutput = outputState ? projected.nodes.find((node: { id: string }) => node.id === outputState.output.id) : undefined; + const outputSize = { + width: existingOutput?.width ?? 352, + height: existingOutput?.height ?? 198, + }; const pendingOutput = outputSource && outputState && outputState.phase !== "done" ? { id: outputState.output.id, type: "video" as const, position: outputState.output.position, - width: existingOutput?.width ?? 352, height: existingOutput?.height ?? 198, - style: { width: existingOutput?.width ?? 352, height: existingOutput?.height ?? 198 }, + width: outputSize.width, height: outputSize.height, + // The injection is rebuilt on every render, so React Flow compares a new + // node object each time and resets `handleBounds` whenever `measured` is + // absent. The pending reference edge then has no path and disappears until + // the node is measured again, which a settled canvas never triggers. + measured: outputSize, + style: { width: outputSize.width, height: outputSize.height }, selectable: false, draggable: false, connectable: false, deletable: false, focusable: false, data: { kind: "video" as const, title: outputState.output.title, diff --git a/tests/browser/timeline_node_output.mjs b/tests/browser/timeline_node_output.mjs index 8e6696214..1e8423ead 100644 --- a/tests/browser/timeline_node_output.mjs +++ b/tests/browser/timeline_node_output.mjs @@ -69,6 +69,9 @@ try { await page.locator(`.react-flow__edge[data-id="timeline-pending:${pendingId}"]`).waitFor(); assert.equal(await panel.locator('progress').count(), 0); await page.waitForTimeout(400); + // The injected pending node keeps its measured size, so the reference edge survives + // later canvas renders instead of vanishing once its first frame is painted. + await page.locator(`.react-flow__edge[data-id="timeline-pending:${pendingId}"]`).waitFor({ state: "visible", timeout: 5000 }); await page.screenshot({ path: "/tmp/opendirector-timeline-pending.png" }); releaseFirst(); await page.unrouteAll({ behavior: "wait" });