From 73ff852648a981c80b3a3492e5de7d39ecea810c Mon Sep 17 00:00:00 2001 From: Stephen McLaughlin <44235289+Steve-Mcl@users.noreply.github.com> Date: Thu, 10 Mar 2022 11:22:59 +0000 Subject: [PATCH] backward compatible equality testing of immutables - make non object equality tests non strict - this aligns with prior condition --- .../src/js/ui/editors/panes/properties.js | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/packages/node_modules/@node-red/editor-client/src/js/ui/editors/panes/properties.js b/packages/node_modules/@node-red/editor-client/src/js/ui/editors/panes/properties.js index 5f704cc65..cfa72be10 100644 --- a/packages/node_modules/@node-red/editor-client/src/js/ui/editors/panes/properties.js +++ b/packages/node_modules/@node-red/editor-client/src/js/ui/editors/panes/properties.js @@ -138,22 +138,17 @@ } } }); + /** * Compares `newValue` with `originalValue` for equality. - * NOTES: - * * If `newValue` is a string or number, comparison is not strict - * * If `newValue` is anything else, comparison is strict * @param {*} originalValue Original value * @param {*} newValue New value * @returns {boolean} true if originalValue equals newValue, otherwise false */ - function isEqual(originalValue, newValue) { + function isEqual(originalValue, newValue) { try { - if (typeof newValue === "string" || typeof newValue === "number") { - return originalValue == newValue; - } - if (typeof newValue === "boolean") { - return originalValue === newValue; + if(originalValue == newValue) { + return true; } return JSON.stringify(originalValue) === JSON.stringify(newValue); } catch (err) {