NodeRed clears context when switching projects

Is there any way to retain the context data written to "file", when switching between different projects.
I uncheck the "Clear Context when switching projects" setting, however, Nodered physically deletes the context folder from my harddrive, whenever a new Project is opened.

The context is retained, when restarting the server, or the nodered service itself.

Nodered v2.2.2

Hi @SSHIntoMe

that sounds like a bug to me. If the 'clear context' option is unchecked, then it shouldn't be clearing context.

Can you raise an issue on github?

Might it be worth upgrading to the latest node red?

Nothing has changed in that area of the code in 3.0.

The issue persists after updating to v3.0.1.

Nodered deletes all context related to the flow, but retains the global context, when switching between different projects. So as long as I use global.get and global.set, instead of context.set or flow.set, the flow works as intended.

I've just reproduced it in 3.0.1 so I went back to 2.2.2 and then to 2.0.0 (which did not have the check box) and the issue is in both of them also.

Shortly after you switch to a new project, the folder for the flow variables in the context folder is deleted. I could identify which folder it was by going to the project folder and looking at the id in the json file of the flow.

One other thing, when you do uncheck the checkbox it does not remain unchecked.

Just to repeat what I said on GitHub - 2.0.0 does not contain this issue because 2.0.0 did not give you the option to have context maintained when switching projects - it would always clear context as that was the well-defined and intended behaviour.

The issue here is whether the newly added feature to disable the clearing of context is being properly honoured in the File Context plugin.

I only went back to 2.0.0 to see about how far back the issue was. It does exist in V2.2.2 which does have the checkbox.

@knolleary Ok it was introduced in v2.2.0, I checked 2.1.6 and it is not there but appears in 2.2.0

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