I'm working on a React-Flow project. I'm changing the layout of the nodes and edges with a button and I want the last thing to happen to be resetting the viewport to be centered (so just fitView).
How can I do this?
I've tried calling fitView() again but this doesn't seem to work at all.
Try calling
fitViewinside of asetTimeoutThere is no need to pass a specific delay to the timeout, since (quoting the docs):
Which in our case is following the re-render of the Flow.