Comments (2)
To address some of the things in here
edge.updatable should add the EdgeAnchor to both the target and source ends if true, or to just the designated end if set to "target" or "source".
This is already the case. If edge.updatable
is true
, both EdgeAnchors
will appear etc.
This should override whatever props are set on the ReactFlow component.
This is also already the case, edge.updatable
always has precedence over the global edgesUpdatable
prop
It feels weird that the onEdgeUpdate callback is the way to toggle "updatable edges". I'm using onEdgesChange for the actual logic of all changes to my edges [...]
onEdgesChange
is not a replacement for onEdgeUpdate
so I'm not sure where the assumption comes from that you can use one or the other.
onEdgesChange
is meant to communicate internal changes to the user, like selecting, adding or removing an edge.
Updates are not part of the changes that are pushed through onEdgesChange
(although it could be argued that these should also go in there ^^)
The reasoning, at least from my point of view, for the requirement of passing an actual onEdgeUpdate
handler is that you as a user have to handle the update. ReactFlow doesn't make assumptions about how an edge should be updated, it only communicates to you that these are the params of the update. You can do whatever you want with the params: maybe you want to validate the update first, maybe you want to modify the edge params before the updating, maybe you wanna do something else entirely.
Assuming that onEdgeUpdate
was not required and it RF would handle the update for you, I could see people opening Issues just like this one complaining why RF assumes to know how the update should be handled 😅
So imo I think having the users take care of this solves it pretty nicely and I don't quite see where the problem lies with passing a basic handler if that's all you need for your use-case?
Meanwhile edgesUpdatable bool seems to only exist to disable "updatable edges"?
More or less - if you passed an update handler and want to toggle the updatable behavior, you can turn it on and off globally with this prop, although as mentioned previously edge.updatable
always has precedence when determining if an edge is updatable.
from xyflow.
That makes sense, I didn't realize until I started playing with it that the onEdgeUpdate
doesn't dispatch any EdgeRemoveChange | EdgeAddChange
to onEdgesChange
.
from xyflow.
Related Issues (20)
- Zoom In, Zoom Out, fitview, and toggle interactivity HOT 4
- Mini Map preview disappeared in 12.0.0-next.18 HOT 1
- Allow drag selection inside nodes HOT 11
- Configure keys with config object HOT 1
- [SvelteFlow] panOnScroll shift+scroll horizontal does not work after clicking canvas HOT 5
- `Edge` should accept a generic `type` argument like `Node` HOT 2
- Node Position Changes Cause All Nodes To Disappear HOT 3
- Provide helper to create an edge from edge params or `Connection` HOT 9
- Large Data React-Window Virtualization HOT 7
- prevent outcoming edge from target handle HOT 3
- Edge marker is not dynamically updated HOT 9
- accept array of classes in noPanClassName HOT 5
- snap guidelines HOT 2
- Extra Objects needed HOT 2
- Node position not matching the nodes list and rendered node HOT 5
- defining a fixed markerEnd (or Start) in custom Edge doesn't work? HOT 2
- I face a bug to align center expand and collapse flow HOT 1
- Export type definitions for individual methods and variables of `useSvelteFlow` functionality HOT 4
- add edge mouseenter event HOT 1
- dynamic handle HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from xyflow.