Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid rerendering because of ReactFlow props change #3298

Closed
mcharfadi opened this issue Mar 29, 2024 · 0 comments · Fixed by #3299
Closed

Avoid rerendering because of ReactFlow props change #3298

mcharfadi opened this issue Mar 29, 2024 · 0 comments · Fixed by #3299

Comments

@mcharfadi
Copy link
Contributor

mcharfadi commented Mar 29, 2024

Here is a Flamegraph after moving a node

image

We can see that the functions onEdgeChange, onEdgeUpdate, onEdgeClick, onNodeClick, onNodeDragStop, onSelectionStart, onSelectionEnd, snapGrid are listed to cause a rerender when they should not. By wrapping these functions in a useCallBack we can avoid this issue.
image

The ReactFlow component should be rerendered (in this case) only if the prop nodes is changed (it is changed after a setNodes)

@mcharfadi mcharfadi self-assigned this Mar 29, 2024
@mcharfadi mcharfadi added this to the 2024.5.0 milestone Mar 29, 2024
mcharfadi added a commit that referenced this issue Mar 29, 2024
Bug: #3298
Signed-off-by: Michaël Charfadi <michael.charfadi@obeosoft.com>
@mcharfadi mcharfadi linked a pull request Mar 29, 2024 that will close this issue
39 tasks
mcharfadi added a commit that referenced this issue Mar 29, 2024
Bug: #3298
Signed-off-by: Michaël Charfadi <michael.charfadi@obeosoft.com>
mcharfadi added a commit that referenced this issue Apr 2, 2024
Bug: #3298
Signed-off-by: Michaël Charfadi <michael.charfadi@obeosoft.com>
mcharfadi added a commit that referenced this issue Apr 2, 2024
Bug: #3298
Signed-off-by: Michaël Charfadi <michael.charfadi@obeosoft.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant