-
Notifications
You must be signed in to change notification settings - Fork 3
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
How to know when nodes or edges are changed/added/deleted? #39
Comments
(Also, due to the way addNode works, it does not generate a 'add' event for a node. |
Also, I need to get the state of the graph and the node input values. Either I am missing something, or I've gotten to the edge of what you have done so far. |
Oops, I missed this sorry. So I brought up some issues with the state change notifications out of ReactFlow on their discord and it's apparently something that they're working on, but since we manage our own state, there's nothing stopping us from rolling our own solution.
So you've probably gotten to the edge of what I've done so far because I don't actually run these graphs, they're just for designing a process that happens elsewhere, but I definitely think we need reactive nodes. That being said, you should be able to use existing ReactFlow hooks as documented here to access that data from within your custom nodes and inputs. As far as reading the state, I think I'd like to expose the Flow component somehow so that it's easy for you to provide your own GraphContextProvider or whatever it is. This was you have full control of the state from within your external application. |
I have tried intercepting the On the plus side:
On the minus side:
|
BTW: I also tried grabbing the |
I can do it with regular react xyflow, but you manage all the nodes and edges (upstream lets the user go either way).
I have tried to upstream functions like onNodesChange / onEdgesChange but that is not useful in many ways (some actions are, some are not). Adding and removing is very helpful. Dragging position changes, not really.
And they don't know the structure of the node.
Rather than 'replace', we can have an event that a specific input's value changed which would be way nicer.
The text was updated successfully, but these errors were encountered: