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

Diagram becomes unresponsive with large data #35

Open
dhruv29011991 opened this issue Jun 29, 2022 · 7 comments
Open

Diagram becomes unresponsive with large data #35

dhruv29011991 opened this issue Jun 29, 2022 · 7 comments
Labels
bug Something isn't working pinned This should not be closed by bots on inactivity

Comments

@dhruv29011991
Copy link

Diagram freezes when using latest version i.e. 2.0.0 with large data of nodes and edges

@dhruv29011991 dhruv29011991 added the bug Something isn't working label Jun 29, 2022
@tisoap
Copy link
Owner

tisoap commented Jun 30, 2022

Hey @dhruv29011991 ! Could you share an URL with a minimal example on CodeSandbox or a minimal GitHub repository where the issue happens?

@dhruv29011991
Copy link
Author

Hello @tisoap, thanks for responding, I have added the URL below for the example please have a look and let know if you require any more information from my end.

https://codesandbox.io/s/react-flow-demo-forked-jno5ub

@tisoap tisoap added the pinned This should not be closed by bots on inactivity label Jul 1, 2022
@agrawal-rohit
Copy link

Facing this issue as well, the performance drop is pretty significant with as few as 25 nodes. I'm using a gridRatio of 9, any higher than that, and the paths lose their smoothness. I believe the issue is occurring because the react-flow hook useNodes re-renders all the edges even when a zoom or pan event occurs.

@tisoap
Copy link
Owner

tisoap commented Oct 25, 2022

On previous versions of react-flow-smart-edge I had debouncing code implemented on the library itself, wich got dropped with the v2 release and the introduction of getSmartEdge function. I need to either re-introduce debouncing or improve performance overall. I will look into navmesh as a possible path-finding substitute for this library.

For anyone facing this issue in the meantime, I recommend debouncing your custom edge implementation before calling getSmartEdge.

@agrawal-rohit
Copy link

Facing this issue as well, the performance drop is pretty significant with as few as 25 nodes. I'm using a gridRatio of 9, any higher than that, and the paths lose their smoothness. I believe the issue is occurring because the react-flow hook useNodes re-renders all the edges even when a zoom or pan event occurs.

So I've memoized the getSmartEdge by only executing it when the position or dimensions of a node changes, and it's a big improvement as it doesn't re-compute the edges during a zoom and pan event, only when a node is dragged around.

On previous versions of react-flow-smart-edge I had debouncing code implemented on the library itself, wich got dropped with the v2 release and the introduction of getSmartEdge function. I need to either re-introduce debouncing or improve performance overall. I will look into navmesh as a possible path-finding substitute for this library.

For anyone facing this issue in the meantime, I recommend debouncing your custom edge implementation before calling getSmartEdge.

Although @tisoap the performance is still not that great and I can notice a lot of stuttering when dragging nodes in a graph of 25-30 nodes. The navmesh integration and other performance improvements would be really appreciated 😇

@AlecSchneider
Copy link

@agrawal-rohit would you mind sharing your code/instructions for how you memoized getSmartEdge are you using React.useMemo or built your own cache?

@tisoap
Copy link
Owner

tisoap commented Apr 18, 2023

@AlecSchneider I didn't memoize getSmartEdge, but I debounced component that was using it. I.E. wait a couple ms after props update before rendering the component

Repository owner locked and limited conversation to collaborators Jun 19, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working pinned This should not be closed by bots on inactivity
Projects
None yet
Development

No branches or pull requests

4 participants