# Adding persistence to node-red-contrib-ui-state-trail node

**URL:** https://discourse.nodered.org/t/adding-persistence-to-node-red-contrib-ui-state-trail-node/34046
**Category:** Dashboard
**Created:** [10 October 2020 09:59 UTC](https://discourse.nodered.org/t/adding-persistence-to-node-red-contrib-ui-state-trail-node/34046 "2020-10-10T09:59:06Z")
**Posts on this page:** 10
**Page:** 1

<div class="post-metadata">

### Author: ![mpxd](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/mpxd/32/2028_2.png) [@mpxd](https://discourse.nodered.org/u/mpxd)
#### Post date: [10 October 2020 09:59 UTC](https://discourse.nodered.org/t/adding-persistence-to-node-red-contrib-ui-state-trail-node/34046/1 "2020-10-10T09:59:06Z")

</div>

> [@\[beta testing\] nodes for live streaming mp4](https://discourse.nodered.org/t/beta-testing-nodes-for-live-streaming-mp4/33743/29):
>
> But some time ago @hotNipi has created a very nice ui widget ([node-red-contrib-ui-state-trail](https://github.com/hotNipi/node-red-contrib-ui-state-trail))

There is one issue with this - and it is already being discussed on Github. There is no persistence. When you switch between another dashboard tab and return to your timeline the data is gone. In the current state this only works if you keep the page open all the time.

---

<div class="post-metadata">

### Author: ![Paul-Reed](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/paul-reed/32/66906_2.png) [@Paul-Reed](https://discourse.nodered.org/u/Paul-Reed)
#### Post date: [10 October 2020 10:47 UTC](https://discourse.nodered.org/t/adding-persistence-to-node-red-contrib-ui-state-trail-node/34046/2 "2020-10-10T10:47:12Z")

</div>

> [@mpxd](#):
>
> There is no persistence

There is persistence if you enable it in node-RED settings.

---

<div class="post-metadata">

### Author: ![mpxd](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/mpxd/32/2028_2.png) [@mpxd](https://discourse.nodered.org/u/mpxd)
#### Post date: [10 October 2020 10:50 UTC](https://discourse.nodered.org/t/adding-persistence-to-node-red-contrib-ui-state-trail-node/34046/3 "2020-10-10T10:50:09Z")

</div>

Hi Paul,

do you mean this?

> [@A guide to understanding 'Persistent Context'](https://discourse.nodered.org/t/a-guide-to-understanding-persistent-context/4115):
>
> This is something I wrote up after playing with the context options. I've filed a PR with some of this added to the Node-RED documentation but thought I'd release it here also. I hope people find it useful. Paul A guide to understanding 'Persistent Context' Prior to Node-RED v0.19.0, data could be stored in context as a global, flow or node. This was stored in memory and would be reset with a restart of Node-RED. As of v.0.19.0 you can now store node, flow and global context data in memory O…

---

<div class="post-metadata">

### Author: ![Paul-Reed](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/paul-reed/32/66906_2.png) [@Paul-Reed](https://discourse.nodered.org/u/Paul-Reed)
#### Post date: [10 October 2020 10:56 UTC](https://discourse.nodered.org/t/adding-persistence-to-node-red-contrib-ui-state-trail-node/34046/4 "2020-10-10T10:56:26Z")

</div>

> [@mpxd](#):
>
> do you mean this?

It means creating a filesystem context store [as described in the docs](https://nodered.org/docs/user-guide/context#saving-context-data-to-the-file-system).

---

<div class="post-metadata">

### Author: ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)
#### Post date: [10 October 2020 11:03 UTC](https://discourse.nodered.org/t/adding-persistence-to-node-red-contrib-ui-state-trail-node/34046/5 "2020-10-10T11:03:42Z")

</div>

If you read that guide, it should (hopefully) help you understand what 'Persistant Context' is and how to use it. As @Paul-Reed said and the dovument says, you have to enable it in settings.js

---

<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: [10 October 2020 11:14 UTC](https://discourse.nodered.org/t/adding-persistence-to-node-red-contrib-ui-state-trail-node/34046/6 "2020-10-10T11:14:25Z")

</div>

Hey @Paul-Reed,  
is it possible to split this into a separate discussion, otherwise we are going way too much off-topic for the live mp4 streaming.  
Thanks!!!!

EDIT - Done! (Paul)

---

<div class="post-metadata">

### Author: ![mpxd](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/mpxd/32/2028_2.png) [@mpxd](https://discourse.nodered.org/u/mpxd)
#### Post date: [10 October 2020 11:52 UTC](https://discourse.nodered.org/t/adding-persistence-to-node-red-contrib-ui-state-trail-node/34046/7 "2020-10-10T11:52:51Z")

</div>

I don't have Node-RED in front of me right now. But from the documentation I would say I just have to set default `contextStorage` to `localfilesystem` and the timeline should store everything to file?

I will give this a try.

Thank you!

---

<div class="post-metadata">

### Author: ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)
#### Post date: [10 October 2020 11:58 UTC](https://discourse.nodered.org/t/adding-persistence-to-node-red-contrib-ui-state-trail-node/34046/8 "2020-10-10T11:58:13Z")

</div>

From the writeup:

> **SUGGESTION:** If you want have all your context data be persistant, setup your settings.js file with the following:
> 
> ```auto
> contextStorage: {
> default : { module: "localfilesystem"}
> },
> 
> ```

---

<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: [10 October 2020 15:22 UTC](https://discourse.nodered.org/t/adding-persistence-to-node-red-contrib-ui-state-trail-node/34046/9 "2020-10-10T15:22:26Z")

</div>

State trail indicates availability and condition of storage like this:  
If persistence is not configured  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/c/3/c34f858ffe14838f7b2432f97571a49bbb52c994.png)

If is configured and in use  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/4/4/44012488d27e84189b065c2ad3429b180f896e5b.png)

The name of stroage ("default" in this case) and count of data points in storage.

---

<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: [9 November 2020 15:22 UTC](https://discourse.nodered.org/t/adding-persistence-to-node-red-contrib-ui-state-trail-node/34046/10 "2020-11-09T15:22:34Z")

</div>

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