diff --git a/frontend/src/utils.js b/frontend/src/utils.js index b8b459dc5..8dbb28c45 100644 --- a/frontend/src/utils.js +++ b/frontend/src/utils.js @@ -249,4 +249,31 @@ export default class Utils { p[key] = val; localStorage.setItem(prefKey, JSON.stringify(p)); }; + + // Source - https://stackoverflow.com/a + // Posted by Ebrahim Byagowi, modified by community. See post 'Timeline' for change history + // Retrieved 2026-01-25, License - CC BY-SA 3.0 + + isEqual(x, y) { + if (x === null || x === undefined || y === null || y === undefined) { return x === y; } + // after this just checking type of one would be enough + if (x.constructor !== y.constructor) { return false; } + // if they are functions, they should exactly refer to same one (because of closures) + if (x instanceof Function) { return x === y; } + // if they are regexps, they should exactly refer to same one (it is hard to better equality check on current ES) + if (x instanceof RegExp) { return x === y; } + if (x === y || x.valueOf() === y.valueOf()) { return true; } + if (Array.isArray(x) && x.length !== y.length) { return false; } + + // if they are dates, they must had equal valueOf + if (x instanceof Date) { return false; } + + // if they are strictly equal, they both need to be object at least + if (!(x instanceof Object)) { return false; } + if (!(y instanceof Object)) { return false; } + + // recursive object equality check + const p = Object.keys(x); + return Object.keys(y).every((i) => p.indexOf(i) !== -1) && p.every((i) => this.isEqual(x[i], y[i])); + } } diff --git a/frontend/src/views/Campaign.vue b/frontend/src/views/Campaign.vue index f1d565230..2f306f517 100644 --- a/frontend/src/views/Campaign.vue +++ b/frontend/src/views/Campaign.vue @@ -102,10 +102,13 @@
- -