react-flow-smart-edge icon indicating copy to clipboard operation
react-flow-smart-edge copied to clipboard

Smart edges don't work as intended with vite

Open johnmal-dev opened this issue 1 year ago • 1 comments

Describe the Bug

After switching to vite, the SmartBezierEdge edges don't work as intended.

Findings:

I attempted to install the most basic setup with and without vite.

I tried using React dev tools to see if there were any noticeable differences.

I found that when moving the nodes around, the vite project's SmartEdge children would alternate between:

  1. SmartEdge > BaseEdge
  2. SmartEdge > BezierEdge > BaseEdge

In the cra project, the SmartEdge children stayed as:

  1. SmartEdge > BaseEdge

Minimal Example

https://github.com/johnmal-dev/react-flow-vite

Steps to Reproduce the Bug or Issue

  1. Move node around
  2. Observe edge colliding with nodes

Expected behavior

I expect the edges to avoid collisions

Screenshots or Videos

Screenshot 2024-06-11 at 8 05 55 PM

Platform

  • OS: macOS
  • Browser: Chrome
  • Version: 3.0.0

Additional context

No response

johnmal-dev avatar Jun 12 '24 00:06 johnmal-dev

@johnmal-dev I was running into this same issue and looked into it more.

It seems that the pathfinding package that this library uses errors when trying to use smoothenPath function.

I get the error ReferenceError: assignment to undecalred variable lastValidCoord: smoothenPath Util.js:167

when I look at the code there, they don't declare the variables with var, let, or const so it is errors.

But this error only happens in dev mode, if you make a production build, it will ignore it and work.

Definitely annoying but this is a bug on the pathfinding package and not this one.

I am assuming CRA ignores these errors in dev as well.

kthyer avatar Jun 17 '24 16:06 kthyer

@kthyer @johnmal-dev Version 4 does not use pathfinding anymore

tisoap avatar Aug 14 '25 22:08 tisoap