fix(recipe-studio): prevent stale empty fitView from offsetting first block zoom

This commit is contained in:
Shine1i 2026-02-26 16:23:27 +01:00
commit 4c97591e4c

View file

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