Coder Social home page Coder Social logo

Comments (7)

tisoap avatar tisoap commented on May 15, 2024 2

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.

from react-flow-smart-edge.

agrawal-rohit avatar agrawal-rohit commented on May 15, 2024 1

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 😇

from react-flow-smart-edge.

tisoap avatar tisoap commented on May 15, 2024

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

from react-flow-smart-edge.

dhruv29011991 avatar dhruv29011991 commented on May 15, 2024

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

from react-flow-smart-edge.

agrawal-rohit avatar agrawal-rohit commented on May 15, 2024

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.

from react-flow-smart-edge.

AlecSchneider avatar AlecSchneider commented on May 15, 2024

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

from react-flow-smart-edge.

tisoap avatar tisoap commented on May 15, 2024

@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

from react-flow-smart-edge.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.