What happens to Context value if you delete the flow (storing to Filesystem)

Hey guys,

I have my context values stored in filesystem (modified the settings.json) anyway, my question is:

  • If i have stuff stored in flow.context etc and DELETE the flow from Node-Red UI. What happens to the value of those context items? does Node-Red automatically remove them from the disk, or do I need to do this manually?

Thanks,

The context items will remain. By default they are stored in the .node-red folder in a folder called 'context'. However if you delete that folder, all context will be removed.

Case 1 - you have one tab with one flow creating a context variable.

  • if you delete the flow and delete the ;context folder' you are all set

Case 2 - you have one tab with two seperate flows and both create seperate context. If you remove flow one and delete the 'context' folder - you will have removed the context variable flow two used along with the one flow one was using.

Case 3 - you have two tabs each with one flow creating seperate context variables. This is the same as case 2 - If you remove the flow from one tab and delete the 'context' folder - you will have removed the context variable from the flow in the secont tab along with the one flow one was using.

You easily can go to the dashboard and select the Context Data icon
Screen Shot 2020-08-25 at 1.41.52 PM

Press the refresh button
Screen Shot 2020-08-25 at 1.44.43 PM

Screen Shot 2020-08-25 at 1.42.11 PM

then the delete button and remove the variable that way.

You could try this by creating a test flow with a flow variable and then deleting the flow and looking at the "Context Data" menu to see if the variable is still there or not :slight_smile:

@ghayne and @zenofmud Thanks for the quick reply.
The issue I have is these were "Flow context" and not global, so when I deleted the flow from UI like below.

image
I can no longer go to the context menu in Node-Red to view the "Flow Context" as the flow itself is gone! so there is no way to see.
I did try the .nodered/context folder, but I see many folders there with ID and I cant tell which is what.
Thank you,

I only had global context when I was showing the example. The same holds true for flow context. You should still be able to select the 'Context Data' tab even it is comes up empty

  • what version of NR are you using?
  • are you using 'Projects'?

Ahh now I see. The answer depends on how you delete the flow.

If you delete the flow by deleting the tab that contains the flow, then yes the flow values stored in storage will be deleted.

However, if you delete the flow by selecting everything in the tab and deleting all the nodes (so the tab still exists) then the data will remain in storage.

You can identify which folder in the context folder is associated to which tab by selecting the tab and looking at the info and you will see the flow's id. That id is the name of the folder containg the flow variables for that tab.

Thanks @zenofmud , I deleted the flow by clicking on tab and hitting Delete (as per my screenshot above) so it should have deleted the value according to your explanation.
Thanks for the help.
Cheers,