docs: comment settled fitView timing rationale

This commit is contained in:
lda
2026-07-08 17:19:56 +07:00 Verified
parent be29b65206
commit 0216f8db4e
@@ -83,6 +83,9 @@ const FitViewOnLayoutChange = ({ layoutKey }: { layoutKey: string }) => {
const { fitView } = useReactFlow(); const { fitView } = useReactFlow();
useEffect(() => { useEffect(() => {
void fitView({ padding: 0.15, duration: 0 }); void fitView({ padding: 0.15, duration: 0 });
// React Flow can measure before the scaled presentation canvas and
// breadcrumb row settle. Fit again on the next frame to align edges with
// the final node boxes without adding a larger measurement framework.
const frame = window.requestAnimationFrame(() => { const frame = window.requestAnimationFrame(() => {
void fitView({ padding: 0.15, duration: 0 }); void fitView({ padding: 0.15, duration: 0 });
}); });