Editor this.changed == true but not sure why?

I seem to have done something silly in uibuilder.

If you open the config in the Editor and press "Done" - even if you haven't made any changes - this.changed is set which adds a blue circle to the node. this.dirty isn't set.


Anyone have any ideas what might be causing this?

I've checked this at the start of the oneditprepare function and the end of the oneditsave function and I can't see any differences.

It isn't a big thing but it is annoying.

Thanks, Julian.

If you export the node JSON, open the dialog and close it so the blue dot shows, then export it again, is there any difference in the JSON?

Good idea. But no, they appear to be identical:

I also did a compare in VScode and they are absolutely identical.

Wait - No! I compared the wrong ones:

The intermediate file has a credentials property that disappears when deployed.

Here is the definition:

    RED.nodes.registerType(moduleName, {
        category: paletteCategory,
        color: paletteColor,
        defaults: {
            name: { value: '' },
            topic: { value: '' },
            url: { value: moduleName, required: true, validate: validateUrl },
            fwdInMessages: { value: false },   // Should we send input msg's direct to output as well as the front-end?
            allowScripts: { value: false },    // Should we allow msg's to send JavaScript to the front-end?
            allowStyles: { value: false },     // Should we allow msg's to send CSS styles to the front-end?
            copyIndex: { value: true },        // DEPRECATED Should the default template files be copied to the instance src folder?
            templateFolder: { value: 'blank' },  // Folder for selected template
            extTemplate: { value: '' }, // Only if templateFolder=external, degit name
            showfolder: { value: false },      // Should a web index view of all source files be made available?
            useSecurity: { value: false },
            sessionLength: { value: defaultSessionLength, validate: validateSessLen },   // 5d - Must have content if useSecurity=true
            tokenAutoExtend: { value: false }, // TODO add validation if useSecurity=true
            oldUrl: { value: undefined },      // If the url has been changed, this is the previous url
            reload: { value: false },          // If true, all connected clients will be reloaded if a file is changed on the edit screens
            //jwtSecret: { value: defaultJwtSecret, validate: validateSecret },   // Must have content if useSecurity=true
        credentials: {
            jwtSecret: { type:'password' },  // text or password
        inputs: 1,
        inputLabels: 'Msg to send to front-end',
        outputs: 2,
        outputLabels: ['Data from front-end', 'Control Msgs from front-end'],
        icon: 'ui_template.png',
        paletteLabel: nodeLabel,
        label: function () { return this.url || this.name || nodeLabel },

So anyone any clues as to why the credentials are changing but not changing?

I think this has been a very long standing edge case that isn't handled as well as it might. A node won't have a credentials property when initially loaded. When you edit the node, it gains a credential property, even though it's empty. That triggers the change detection when it probably shouldn't.

There may be some more subtlety to it then that, but that's all for a Saturday morning.

In summary, I don't think this is due to anything you've done.

OK, thanks Nick, sorry to disturb your Saturday. Setting up for my daughters 17th birthday party in the garden anyway now so I need to focus on shelter and lights :grinning:

I'll try to take a look at the core code to see if I can spot a work-around. I should probably give it a default anyway.

I've changed the processing so that an empty credential has a default non-empty string value always. This seems to get rid of the problem once you've done one commit.

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