You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The issue I'm running into is that I can't determine if an edge deletion via onEdgesChange is due to a node being deleted or a user purposefully deleting an edge. Especially since the edge Change events run before the node one does.
Is there any way to prevent those extra edge-change events from being sent out (or at least attributing them to the coming node change event)?
For reference, I am using :applyDefaults="false" set so that I can use an async call to apply the relevant change using onEdgesChange and onNodesChange. My graph is modeled as rows in a DB with a parentId column. When a user deletes an edge, I null out the parentId from the relevant row. When a user deletes a node, I want to make it so that whatever chain exists gets re-connected between the parent and the child to avoid disruptions in my graph - hence why it becomes an issue for me that the edges are deleted before the node deletion. I also tend to prefer keeping things as atomic transactions - so while I could make it so that I treat any set of edge changes with >1edge removal as a no-op for the node change to handle, it runs into an issue if there's only 1 edge on the node and then the node removal fails for whatever reason.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
The issue I'm running into is that I can't determine if an edge deletion via
onEdgesChange
is due to a node being deleted or a user purposefully deleting an edge. Especially since the edge Change events run before the node one does.Is there any way to prevent those extra edge-change events from being sent out (or at least attributing them to the coming node change event)?
For reference, I am using
:applyDefaults="false"
set so that I can use an async call to apply the relevant change usingonEdgesChange
andonNodesChange
. My graph is modeled as rows in a DB with aparentId
column. When a user deletes an edge, I null out theparentId
from the relevant row. When a user deletes a node, I want to make it so that whatever chain exists gets re-connected between the parent and the child to avoid disruptions in my graph - hence why it becomes an issue for me that the edges are deleted before the node deletion. I also tend to prefer keeping things as atomic transactions - so while I could make it so that I treat any set of edge changes with >1edge removal as a no-op for the node change to handle, it runs into an issue if there's only 1 edge on the node and then the node removal fails for whatever reason.Beta Was this translation helpful? Give feedback.
All reactions