enhance fitView scheduling
This commit is contained in:
@@ -52,7 +52,12 @@ export function BatchProvider<NodeType extends Node = Node, EdgeType extends Edg
|
|||||||
} else if (fitViewQueued) {
|
} else if (fitViewQueued) {
|
||||||
// If there are no changes to the nodes, we still need to call setNodes
|
// If there are no changes to the nodes, we still need to call setNodes
|
||||||
// to trigger a re-render and fitView.
|
// to trigger a re-render and fitView.
|
||||||
setNodes(next);
|
window.requestAnimationFrame(() => {
|
||||||
|
const { fitViewQueued, nodes, setNodes } = store.getState();
|
||||||
|
if (fitViewQueued) {
|
||||||
|
setNodes(nodes);
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, []);
|
}, []);
|
||||||
|
|||||||
Reference in New Issue
Block a user