Merge pull request #4714 from GogoVega/fix-4712

Deleting a grouped node should update the group
This commit is contained in:
Nick O'Leary 2024-05-23 13:43:26 +01:00 committed by GitHub
commit ae7b9fe62e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -921,6 +921,17 @@ RED.editor = (function() {
dirty: startDirty
}
if (editing_node.g) {
const group = RED.nodes.group(editing_node.g);
// Don't use RED.group.removeFromGroup as that emits
// a change event on the node - but we're deleting it
const index = group?.nodes.indexOf(editing_node) ?? -1;
if (index > -1) {
group.nodes.splice(index, 1);
RED.group.markDirty(group);
}
}
RED.nodes.dirty(true);
RED.view.redraw(true);
RED.history.push(historyEvent);