node-red / node-red

Low-code programming for event-driven applications
http://nodered.org
Apache License 2.0
18.96k stars 3.31k forks source link

Allow nodes to return additional history entries in onEditSave #4710

Closed knolleary closed 1 month ago

knolleary commented 1 month ago

Fixes #4704

Editing link nodes can have a side-effect on the configurations of other link nodes. The existing oneditsave mechanism does not provide any way for those side-effects to be automatically captured in the edit history.

This was the root cause of the linked issue - editing the link in node via the edit dialog, modified the link out nodes, but those modifications didn't get recorded in edit history

This PR fixes it by allowing onEditSave to return an object containing a history property. This should be an array of additional edit history events that will get merged with the node's own edit event into a single multi history event. This allows all of the node modifications to be undone in one.