Upgrading node Properties after module updated

During my node development, after a breaking change version is released a new properties are either being added or removed.

On the Node side after upgrade i can simply modify the properties i have in the memory to the new version but the UI side it would still be the old version, so i would have to add another function during the start of "oneditprepare" to update the properties and update the ui.

So my question would it be possible to use some sort of an Event that would update both UI and Node Properties at the same time during either initalization of the app or after module has been updated.

Thanks

This topic keeps making an appearance.

Might be worth taking a read on this for some possible solutions :
I'm sure its relevance should help

Hey,

Yeah in that topic it's what I'm currently doing and I actually have a region in the code on both edit dialog code and handle input code

that basically does that, but my question is would it be possible to do a one time update on the node instead of running the same code each time i open the dialog.

but from that other flow it seems that there is none for now.

I think that the only ways you could do it right now would be:

  • Run a script/flow against Node-RED's flow file to change any existing nodes of that type.
  • Write custom runtime code into your node that will find all of the existing nodes of the correct type and force a change into them and mark them all as changed so that they all get a blue dot and require a deploy.

Most things are possible in Node-RED, not everything is necessarily desirable though. :slight_smile:

1 Like

Personally, I created a Migration script in the editor which allows the user to migrate in one click and to be able to see the changes. It uses history to make undo/redo applicable.

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