After just adding an oneditdelete function to destroy and delete the editor after use. I noticed that the function node included with Node-RED does not do the same thing.
Not sure if it worth creating a PR over.
As you can see when a function node in use in a flow is deleted the following warning is visible within the developer console.
The warning message occurs whenever an editor is closed and it detects orphaned models.
I know (and have just checked in case of a regression) that the core function node (nodes/core/function/10-function.html) does indeed call .destroy() in both oneditcancel and oneditsave).
However, there may be a timing issue. Since there is more than 1 model to destroy, the destruction of the first may inadvertently be detecting the (as yet) still un-destroyed models.
Feel free to investigate and offer a PR if you find the cause is inside Node-RED (and not some other node)
PS: That code is in editor-client/src/js/ui/editors/code-editors/monaco.js around line 165 (search for "//Handles orphaned models")
This is what a node we have developed does, I found the warning was when I deleted the node, to remove the warning I had to add this to the oneditdelete function.
oneditdelete: function () {
if (!this.editor) {
return;
}
this.editor.destroy();
delete this.editor;
},