When I edit a node that depends on a config node and I use the "add new ..." option in the standard config node selector input field a config node gets created as far as I can tell but I see no "nodes:add" event emitted.
When I then click on "update" on the config node editing panel I see a "nodes:changed" event for the config node.
It seems to me that it's a bug for a change event to be issued on a node without a prior add event. Am I wrong and this is intentional?
Update: I was wrong, an add event does get generated. First a change event gets generated for the current config node, and then an add event for the new config node, which I overlooked.
nodes:change event have to be emitted explicitly pretty much everywhere one calls
RED.history.push or is there something that generates those events under the hood? For example, the ui dashboard changes nodes and I don't see code to generate the event. Is it generated somewhere else? E.g., node-red-dashboard/ui_base.html at master · node-red/node-red-dashboard · GitHub adjusts the sort order but I don't see a RED.events.emit in there. Same thing 20 lines down and again 50 lines further. I'm asking because I'm writing similar code and wonder...
It isn't strictly necessary to emit the event. But where there are UI components that may need to update a view of a node is changed in some way then it should be emitted.
The main consumer of the events is the info sidebar that has the tree view of everything. It allows it to update the node label in the tree should it depend on any of the changed properties.
This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.