From 29eed4bfb3ff74ea6207fc4221817937501332d5 Mon Sep 17 00:00:00 2001 From: dev Date: Sun, 22 Nov 2026 14:47:56 +0800 Subject: [PATCH] [fix] canvas: keep the pending timeline output edge on screen ## summary - `WorkspaceView` rebuilds the injected pending output node on every render without `measured`. React Flow's `adoptUserNodes`/`parseHandles` drops that node's `handleBounds` whenever `measured` is absent, so `getEdgePosition` returned null and the `timeline-pending:` reference edge vanished after its first frame. - `onNodesChange` also filters the pending node's `dimensions` changes, so `measurements[pendingId]` stayed undefined and no later render restored the measurement. - Give the injection its declared size as `measured` and assert in the browser workflow that the edge is still visible after a 400 ms pause. --- src/canvas/workspace/WorkspaceView.tsx | 13 +++++++++++-- tests/browser/timeline_node_output.mjs | 3 +++ 2 files changed, 14 insertions(+), 2 deletions(-) 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" });