mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
Merge pull request #3481 from Steve-Mcl/fix-node-val-changed
do JSON comparison of old value/new value
This commit is contained in:
commit
49e69a54bd
@ -107,7 +107,7 @@
|
|||||||
newValue = "";
|
newValue = "";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (node[d] != newValue) {
|
if (!isEqual(node[d], newValue)) {
|
||||||
if (node._def.defaults[d].type) {
|
if (node._def.defaults[d].type) {
|
||||||
// Change to a related config node
|
// Change to a related config node
|
||||||
var configNode = RED.nodes.node(node[d]);
|
var configNode = RED.nodes.node(node[d]);
|
||||||
@ -139,6 +139,23 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Compares `newValue` with `originalValue` for equality.
|
||||||
|
* @param {*} originalValue Original value
|
||||||
|
* @param {*} newValue New value
|
||||||
|
* @returns {boolean} true if originalValue equals newValue, otherwise false
|
||||||
|
*/
|
||||||
|
function isEqual(originalValue, newValue) {
|
||||||
|
try {
|
||||||
|
if(originalValue == newValue) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return JSON.stringify(originalValue) === JSON.stringify(newValue);
|
||||||
|
} catch (err) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update the node credentials from the edit form
|
* Update the node credentials from the edit form
|
||||||
* @param node - the node containing the credentials
|
* @param node - the node containing the credentials
|
||||||
|
Loading…
Reference in New Issue
Block a user