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, }); }); });