# New editor event when all nodes have been loaded

**URL:** <https://discourse.nodered.org/t/new-editor-event-when-all-nodes-have-been-loaded/60314>\
**Category:** Feature Requests\
**Created:** [24 March 2022 22:42 UTC](https://discourse.nodered.org/t/new-editor-event-when-all-nodes-have-been-loaded/60314 "2022-03-24T22:42:49Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![BartButenaers](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bartbutenaers/32/10476_2.png) [@BartButenaers](https://discourse.nodered.org/u/BartButenaers)\
**Post date:** [24 March 2022 22:42 UTC](https://discourse.nodered.org/t/new-editor-event-when-all-nodes-have-been-loaded/60314/1 "2022-03-24T22:42:50Z")

</div>

Hi folks,

Every time I need to develop a sidebar panel in the flow editor, I am struggling to initialize its content. Because the html content of the sidebar panel is being constructed in the `onpaletteadd` event (of the corresponding config node). But that event happens rather soon, so at that moment no nodes have been loaded yet into the editor. And I need information about those nodes to construct the content of my sidebar panel...

When I add this line of code to the [nodes.js](https://github.com/node-red/node-red/blob/master/packages/node_modules/%40node-red/editor-client/src/js/nodes.js#L2286) file:

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/a/a/aa55a9f7d2a8a2c924ac18c79eeb63048d383333.png)

Then I can easily listen for that event, and get access to all nodes in the event handler:

```auto
RED.events.on("workspace:loaded", function(node) {
    RED.nodes.eachConfig(function(configNode) {
          // Now all the nodes are loaded...
    })
})

```

Is it ok to create a pull request to emit this event, and to update the [Editor API](https://nodered.org/docs/api/ui/events/) documentation?

Thanks !!!  
Bart

---

<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:** [24 March 2022 23:18 UTC](https://discourse.nodered.org/t/new-editor-event-when-all-nodes-have-been-loaded/60314/2 "2022-03-24T23:18:02Z")

</div>

How does your sidebar handle nodes being added and removed while the user is editing the flows?

Do you need to keep it up to date as the flows are edited?

If so, it would be better to listen for the `nodes:add` and related events to keep your sidebar in sync.

[https://nodered.org/docs/api/ui/events/#flow-configuration-events](https://nodered.org/docs/api/ui/events/#flow-configuration-events)

---

<div class="post-metadata">

**Author:** ![BartButenaers](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bartbutenaers/32/10476_2.png) [@BartButenaers](https://discourse.nodered.org/u/BartButenaers)\
**Post date:** [24 March 2022 23:26 UTC](https://discourse.nodered.org/t/new-editor-event-when-all-nodes-have-been-loaded/60314/3 "2022-03-24T23:26:50Z")

</div>

Hi Nick,

I indeed should have mentioned that. In this case I am only interested in nodes that have been deployed on the server. Nodes that are being added to the editor are not interesting for me, but as soon as they are deployed they become important. From then on they should appear in my sidebar, so the user can communicate with the server-side counterparts of the deployed nodes (via their representation on the sidebar panel).

So it would be nice if I could update the content of my sidebar panel:

1. Initially when the flow editor imports all deployed nodes from the server (via the above new event).
2. At every deploy, via the 'deploy' editor event.

---

<div class="post-metadata">

**Author:** ![BartButenaers](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bartbutenaers/32/10476_2.png) [@BartButenaers](https://discourse.nodered.org/u/BartButenaers)\
**Post date:** [24 March 2022 23:32 UTC](https://discourse.nodered.org/t/new-editor-event-when-all-nodes-have-been-loaded/60314/4 "2022-03-24T23:32:38Z")

</div>

Perhaps the description of the particular use case will make it more clear.

It is a sidebar panel for the FlexDash dashboard from @tve. You can create multiple FlexDash config nodes. As soon a such a config node is being deployed, it becomes a real FlexDash dashboard instance on the server. By visualizing those deployed config nodes in the sidebar panel, you get in fact a list of running dashboards. That way the user can start interacting with all his running dashboards via the sidebar panel. For example rebuild a dashboard, or show the logs, or ...

---

<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:** [20 April 2022 15:19 UTC](https://discourse.nodered.org/t/new-editor-event-when-all-nodes-have-been-loaded/60314/5 "2022-04-20T15:19:21Z")

</div>

> [@knolleary](#):
>
> How does your sidebar handle nodes being added and removed while the user is editing the flows?
> 
> Do you need to keep it up to date as the flows are edited?
> 
> If so, it would be better to listen for the `nodes:add` and related events to keep your sidebar in sync.

Something that is difficult to do just with add&remove events is to maintain a persisted list of dependent nodes. For example, a UI tab might need a list of the panels it contains. This is different from `.users` if there is some per-dependent info or if the order matters. The problem with just add/remove is that it's impossible to prune non-existent dependents from the list. For example, on import, some of the dependent nodes may not have been imported.

---

<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:** [19 June 2022 15:20 UTC](https://discourse.nodered.org/t/new-editor-event-when-all-nodes-have-been-loaded/60314/6 "2022-06-19T15:20:03Z")

</div>

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