Skip to content

Delete nodes cascade to descendants - #806

Merged
lukasz-jazwa merged 2 commits into
mainfrom
delete-nodes-cascade
Sep 14, 2026
Merged

lukasz-jazwa merged 2 commits into
mainfrom
delete-nodes-cascade

Conversation

@Jacek-Synergy

@Jacek-Synergy Jacek-Synergy commented Sep 14, 2026 •

Copy link
Copy Markdown
Collaborator

What

NgDiagramModelService.deleteNodes now cascades to all descendants of the deleted nodes (children, grandchildren, ...). Edges connected to any deleted node are removed, as before. This matches deleteSelection.

Why

Deleting a group with deleteNodes([groupId]) left its children in the model with a groupId that pointed at a node that no longer existed. A missing parent counts as visible, so children of a hidden group popped back into view as orphans.

The task allowed two fixes: clear the children's groupId, or cascade like deleteSelection. Cascade was chosen because both delete paths now behave the same and the docs need no special case.

Backward compatibility

  • Signature unchanged. No api-report change.
  • Behavior change: deleteNodes on a node with descendants now removes the descendants and their edges too. Code that deleted a group and then re-parented the surviving children itself will now find those children gone. To keep the children, call NgDiagramGroupsService.removeFromGroup first, then deleteNodes.
  • Nodes without descendants: no change.

Comment thread CHANGELOG.md Outdated
@lukasz-jazwa
lukasz-jazwa merged commit 016381c into main Sep 14, 2026
2 checks passed
@lukasz-jazwa
lukasz-jazwa deleted the delete-nodes-cascade branch September 14, 2026 12:26
Jacek-Synergy added a commit that referenced this pull request Sep 16, 2026
Conflict resolution:
- deleteNodes keeps main's descendant cascade (#806) and feeds the cascaded
  set into partitionIncidentEdges for detach-on-delete.
- copy-paste takes main's structure (#807: resolvePastedEnd,
  collectFreeEdgeEndpointPositions, calculateCenter, empty-paste early exit)
  and re-applies from the branch: manual-routing points shifted with a free
  pasted end, and the dangling-aware isInsideCopiedSet copy rule gated on
  danglingEdges.enabled.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@lukasz-jazwa lukasz-jazwa mentioned this pull request Oct 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants