# API addwidget()

**URL:** <https://discourse.nodered.org/t/api-addwidget/13604>\
**Category:** Dashboard\
**Created:** [23 July 2019 11:13 UTC](https://discourse.nodered.org/t/api-addwidget/13604 "2019-07-23T11:13:37Z")\
**Posts on this page:** 5\
**Page:** 2

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [25 July 2019 19:40 UTC](https://discourse.nodered.org/t/api-addwidget/13604/21 "2019-07-25T19:40:01Z")

</div>

Comments heh. Who would have thought ! ( but what does the code actually do ?...)

---

<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:** [25 July 2019 20:40 UTC](https://discourse.nodered.org/t/api-addwidget/13604/22 "2019-07-25T20:40:54Z")

</div>

By just reading the code seems to me that  
`replayMessages` object used for `msg` storage and filled on every input if there is something to emit. Socket has listener for `ui-replay-state` which seems to happen on new connection and then for every `msg` in `replayMessages` socket emits `update-value`  
`storeFrontEndInputAsState` doesn't affect this behavior in any way

---

<div class="post-metadata">

**Author:** ![Thierry](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/thierry/32/8654_2.png) [@Thierry](https://discourse.nodered.org/u/Thierry)\
**Post date:** [20 December 2019 15:53 UTC](https://discourse.nodered.org/t/api-addwidget/13604/23 "2019-12-20T15:53:19Z")

</div>

@dceejay @hotNipi I can do a PR on node-red-dashboard to add this behavior:  
In order to keep existing behavior (and not break existing widget behavior) I propose to define a new boolean in addWidget API `persistantFrontEndValue` (default true).  
When set to false, then `update-value` is not sent on new connection.  
When set to true, keep existing behavior.

What do you think about such PR ?

---

<div class="post-metadata">

**Author:** ![Thierry](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/thierry/32/8654_2.png) [@Thierry](https://discourse.nodered.org/u/Thierry)\
**Post date:** [6 January 2020 08:59 UTC](https://discourse.nodered.org/t/api-addwidget/13604/24 "2020-01-06T08:59:57Z")

</div>

@dceejay  
Hello any feedback on the PR proposal is welcome.  
I don't want to spend time on such dev if there is no chance to be considered/merged.  
Thanks

---

<div class="post-metadata">

**Author:** ![Thierry](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/thierry/32/8654_2.png) [@Thierry](https://discourse.nodered.org/u/Thierry)\
**Post date:** [7 January 2020 13:50 UTC](https://discourse.nodered.org/t/api-addwidget/13604/25 "2020-01-07T13:50:00Z")

</div>

PR done : [https://github.com/node-red/node-red-dashboard/pull/558](https://github.com/node-red/node-red-dashboard/pull/558)

[Previous page](https://discourse.nodered.org/t/api-addwidget/13604.md?page=1)
