From 4c97591e4c53cd3c43dd7ddca621cba951010b06 Mon Sep 17 00:00:00 2001 From: Shine1i Date: Thu, 26 Feb 2026 16:23:27 +0100 Subject: [PATCH] fix(recipe-studio): prevent stale empty fitView from offsetting first block zoom --- .../src/features/recipe-studio/recipe-studio-page.tsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/studio/frontend/src/features/recipe-studio/recipe-studio-page.tsx b/studio/frontend/src/features/recipe-studio/recipe-studio-page.tsx index a5359b63fb..cfe6b72250 100644 --- a/studio/frontend/src/features/recipe-studio/recipe-studio-page.tsx +++ b/studio/frontend/src/features/recipe-studio/recipe-studio-page.tsx @@ -632,6 +632,10 @@ export function RecipeStudioPage({ return; } lastProcessedFitTickRef.current = fitViewTick; + const targetNodes = getFitNodeIdsIgnoringNotes(reactFlowInstance.getNodes()); + if (targetNodes.length === 0) { + return; + } let frame2 = 0; let frame3 = 0; const frame1 = window.requestAnimationFrame(() => { @@ -639,7 +643,7 @@ export function RecipeStudioPage({ frame3 = window.requestAnimationFrame(() => { reactFlowInstance.fitView({ duration: 320, - nodes: getFitNodeIdsIgnoringNotes(reactFlowInstance.getNodes()), + nodes: targetNodes, }); }); });