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

**URL:** https://discourse.nodered.org/t/editor-this-changed-true-but-not-sure-why/47679
**Category:** Developing Nodes
**Created:** [25 June 2021 19:54 UTC](https://discourse.nodered.org/t/editor-this-changed-true-but-not-sure-why/47679 "2021-06-25T19:54:52Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)
#### Post date: [25 June 2021 19:54 UTC](https://discourse.nodered.org/t/editor-this-changed-true-but-not-sure-why/47679/1 "2021-06-25T19:54:52Z")

</div>

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.

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/f/8/f84ca95bfcf06411e07732bd403866f045bf72c5.png)

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.

---

<div class="post-metadata">

### Author: ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)
#### Post date: [25 June 2021 20:33 UTC](https://discourse.nodered.org/t/editor-this-changed-true-but-not-sure-why/47679/2 "2021-06-25T20:33:39Z")

</div>

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?

---

<div class="post-metadata">

### Author: ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)
#### Post date: [25 June 2021 20:39 UTC](https://discourse.nodered.org/t/editor-this-changed-true-but-not-sure-why/47679/3 "2021-06-25T20:39:23Z")

</div>

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

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/f/0/f078e0b899bdd7cba095411e37db92237c7cc857.png)

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

Wait - No! I compared the wrong ones:

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/4/1/41c4fe0e96f6b4429680599c97481da2fce0b31a.png)

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

Here is the definition:

```auto
    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 },

```

---

<div class="post-metadata">

### Author: ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)
#### Post date: [26 June 2021 10:08 UTC](https://discourse.nodered.org/t/editor-this-changed-true-but-not-sure-why/47679/4 "2021-06-26T10:08:17Z")

</div>

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

---

<div class="post-metadata">

### Author: ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)
#### Post date: [26 June 2021 10:23 UTC](https://discourse.nodered.org/t/editor-this-changed-true-but-not-sure-why/47679/5 "2021-06-26T10:23:08Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)
#### Post date: [26 June 2021 10:53 UTC](https://discourse.nodered.org/t/editor-this-changed-true-but-not-sure-why/47679/6 "2021-06-26T10:53:01Z")

</div>

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 😀

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.

---

<div class="post-metadata">

### Author: ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)
#### Post date: [26 June 2021 13:18 UTC](https://discourse.nodered.org/t/editor-this-changed-true-but-not-sure-why/47679/7 "2021-06-26T13:18:09Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)
#### Post date: [10 July 2021 13:18 UTC](https://discourse.nodered.org/t/editor-this-changed-true-but-not-sure-why/47679/8 "2021-07-10T13:18:51Z")

</div>

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