[💡 Feature-Request]: Add option to remove all child nodes of a parent #1029
snoozbuster
started this conversation in
Ideas
Replies: 1 comment 7 replies
-
Changing the current behavior of |
Beta Was this translation helpful? Give feedback.
7 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Given you have two nodes such as:
If you select
parent
and delete it usingBackspace
(or whatever yourdeleteKeyCode
is configured to), thenchild
will be deleted. However, programmatically callingremoveNodes(['parent'], true)
does not removechild
, it leaves it in the graph. In this second case, the child node has aparentNode
property still refers to a node which now no longer exists - this also, surprisingly, does not trigger any errors or anything.The root cause of this is because the code responsible for hunting down child nodes and adding them to the remove set actually lives in
Pane.vue
, not inremoveNodes
as I'd have guessed. Is there some reason for these two to act differently? I would have expected that internally,Pane
would basically just be callingremoveNodes(selectedNodes, true)
(or something very similar). Is this something that can be changed (moved intoremoveNodes
)? To fix this in my application, which supports deleting nodes with either thedeleteKeyCode
or an explicit delete button, I will have to write some code which explicitly goes and cleans up child nodes, just for the explicit delete case - which not only feels messy and means more code is necessary, but is actually somewhat of a challenge in my particular case.Beta Was this translation helpful? Give feedback.
All reactions