# Missing nodes:add event in editor when adding config node

**URL:** <https://discourse.nodered.org/t/missing-nodes-add-event-in-editor-when-adding-config-node/61213>\
**Category:** General\
**Created:** [13 April 2022 05:35 UTC](https://discourse.nodered.org/t/missing-nodes-add-event-in-editor-when-adding-config-node/61213 "2022-04-13T05:35:42Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![tve](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/tve/32/59475_2.png) [@tve](https://discourse.nodered.org/u/tve)\
**Post date:** [13 April 2022 05:35 UTC](https://discourse.nodered.org/t/missing-nodes-add-event-in-editor-when-adding-config-node/61213/1 "2022-04-13T05:35:42Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [13 April 2022 06:51 UTC](https://discourse.nodered.org/t/missing-nodes-add-event-in-editor-when-adding-config-node/61213/2 "2022-04-13T06:51:52Z")

</div>

Please raise an issue

---

<div class="post-metadata">

**Author:** ![tve](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/tve/32/59475_2.png) [@tve](https://discourse.nodered.org/u/tve)\
**Post date:** [13 April 2022 15:52 UTC](https://discourse.nodered.org/t/missing-nodes-add-event-in-editor-when-adding-config-node/61213/3 "2022-04-13T15:52:17Z")

</div>

Does the `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](https://github.com/node-red/node-red-dashboard/blob/master/nodes/ui_base.html#L2290-L2331) 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...

---

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [13 April 2022 18:04 UTC](https://discourse.nodered.org/t/missing-nodes-add-event-in-editor-when-adding-config-node/61213/4 "2022-04-13T18:04:50Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [12 June 2022 18:05 UTC](https://discourse.nodered.org/t/missing-nodes-add-event-in-editor-when-adding-config-node/61213/5 "2022-06-12T18:05:20Z")

</div>

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.
