# Not understanding how/when Dashboard UI updated

**URL:** <https://discourse.nodered.org/t/not-understanding-how-when-dashboard-ui-updated/57722>\
**Category:** Dashboard\
**Tags:** node-red-dashboard\
**Created:** [3 February 2022 13:30 UTC](https://discourse.nodered.org/t/not-understanding-how-when-dashboard-ui-updated/57722 "2022-02-03T13:30:23Z")\
**Posts on this page:** 7\
**Page:** 2

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [16 February 2022 21:04 UTC](https://discourse.nodered.org/t/not-understanding-how-when-dashboard-ui-updated/57722/21 "2022-02-16T21:04:16Z")

</div>

> [@solarslurpie](#):
>
> Ideally I would think a property on the UI node could be set that says to refresh on every browser page opening of it or refresh.

What do you mean by refreshing the ui node. A ui node will display whatever data is has been sent. There is no need to refresh anything. Looking at the flow you posted in the first post the Time Growing node will show whatever was sent to it by the triggering of the inject node on startup. If it isn't showing anything then that means it was not sent anything by that initial inject, or it has been cleared by a later output. I notice you have two inputs to the function node, perhaps that is a clue. To check that, add a debug node connected to the output of the function node, give the debug node a name, and set it output to the console and restart node-red in a terminal and you will see what gets sent to the Time Growing node on startup.

**[Edit]** Alternatively, if you are picking up data from context in the function node then perhaps that data has not yet been initialised when you first run the function.

---

<div class="post-metadata">

**Author:** ![hotNipi](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/hotnipi/32/383_2.png) [@hotNipi](https://discourse.nodered.org/u/hotNipi)\
**Post date:** [16 February 2022 21:31 UTC](https://discourse.nodered.org/t/not-understanding-how-when-dashboard-ui-updated/57722/22 "2022-02-16T21:31:25Z")

</div>

> [@solarslurpie](#):
>
> Ideally I would think a property on the UI node could be set that says to refresh on every browser page opening of it or refresh.

Dashboard widgets created at the moment you open/refresh the dashboard. Means that they die at the moment you close the page (or do refresh). No way the dead widget can talk with the server side. Widgets are always created from scratch. They have knowledge only about the configuration the user has been set up. No data, no values. (can have some kind of default value) Widgets are so to say "dummy". They don't care about your flow, they do respect agreed protocol of incoming messages. Like - if the msg.payload contains a number, I'll show it.

May be it is simpler to think about it like push messaging system where dashboard widgets can only react to the messages the server side sends.

There is one side effect which may seem a bit confusing. The dashboard has "replayMessage" system built in. Simplified explanation may be something like this: In case of dashboard page opened, the server side (re)sends **last known** message for each widget.

This way you can create simpler flows where you don't have take any care about existence or state of the dashboard in your flow logical part. You do your calculations and send calculated value to the dashboard widget and that's it.

Of course the world is not that simple and there is many cases where the replayMessage system is not enough and then there is `ui_control` node, firing messages when dashboard connects. Taking this as trigger, you can make decisions to run some flows to calculate again or retrieve some states from devices or what ever it takes to satisfy your needs and again send the results to the dashboard widgets to show.

---

<div class="post-metadata">

**Author:** ![rakgupta](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/rakgupta/32/42535_2.png) [@rakgupta](https://discourse.nodered.org/u/rakgupta)\
**Post date:** [16 February 2022 21:52 UTC](https://discourse.nodered.org/t/not-understanding-how-when-dashboard-ui-updated/57722/23 "2022-02-16T21:52:54Z")

</div>

> [@hotNipi](#):
>
> there is `ui_control` node, firing messages when dashboard connects. Taking this as trigger, you can make decisions to run some flows to calculate again

That is exactly what I do and what I had suggested here

> [@Not understanding how/when Dashboard UI updated](https://discourse.nodered.org/t/not-understanding-how-when-dashboard-ui-updated/57722/6):
>
> In my flow, the "Manual Startup" inject node is only if I want to start the flow manually. It doesn't do anything otherwise. The ui\_control node is the one that actually starts the flow when the user starts the dashboard ui. Hope that helps The flow shown above also does a refresh when the user changes tabs. Here is the flow: [{"id":"c319afa4.557968","type":"group","z":"c1b9d37f.b6443","style":{"stroke":"#999999","stroke-opacity":"1","fill":"none","fill-opacity":"1","label":true,"label-positi…

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [16 February 2022 21:54 UTC](https://discourse.nodered.org/t/not-understanding-how-when-dashboard-ui-updated/57722/24 "2022-02-16T21:54:42Z")

</div>

> [@rakgupta](#):
>
> That is exactly what I do and what I had suggested here

But for a ui text node that is not necessary, as the text node remembers what it is supposed to be displaying, as do all the basic dashboard nodes I believe. So for this sort of display it is not necessary to refresh, which is why I was attempting to simplify the problem for the OP.

---

<div class="post-metadata">

**Author:** ![hotNipi](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/hotnipi/32/383_2.png) [@hotNipi](https://discourse.nodered.org/u/hotNipi)\
**Post date:** [16 February 2022 22:12 UTC](https://discourse.nodered.org/t/not-understanding-how-when-dashboard-ui-updated/57722/25 "2022-02-16T22:12:25Z")

</div>

Mostly the `ui_control` node is needed when widget's configuration is changed on fly. Like if you change gauge's min and max values and maybe some other properties with control message. As widget can't remember those changes and then if you do page reload - the widget is created from scratch and the min and max values are taken from configuration defaults again. So the widget shows up with wrong state so to say.

In such cases you'll need to create smart enough flows wired to the `ui_control` node to determine current state and send correct control message to the widget.

---

<div class="post-metadata">

**Author:** ![rakgupta](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/rakgupta/32/42535_2.png) [@rakgupta](https://discourse.nodered.org/u/rakgupta)\
**Post date:** [16 February 2022 22:22 UTC](https://discourse.nodered.org/t/not-understanding-how-when-dashboard-ui-updated/57722/26 "2022-02-16T22:22:58Z")

</div>

> [@Colin](#):
>
> So for this sort of display it is not necessary to refresh, which is why I was attempting to simplify the problem for the OP.

You are right. I understood the situation a little differently - I thought they wanted to calculate at the time the user connected to the ui or changed pages. Many ways to ski the cat I guess!

---

<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:** [18 March 2022 22:23 UTC](https://discourse.nodered.org/t/not-understanding-how-when-dashboard-ui-updated/57722/27 "2022-03-18T22:23:43Z")

</div>

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

[Previous page](https://discourse.nodered.org/t/not-understanding-how-when-dashboard-ui-updated/57722.md?page=1)
