Skip to content

Commit ef5e9d9

Browse files
authored
Merge pull request #1111 from appwrite/fix-push-settings
fix: improve object comparison logic in getObjectChanges function
2 parents 0b01a39 + d342e93 commit ef5e9d9

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

templates/cli/lib/commands/push.js.twig

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -417,8 +417,17 @@ const getObjectChanges = (remote, local, index, what) => {
417417

418418
if (remote[index] && local[index]) {
419419
for (let [service, status] of Object.entries(remote[index])) {
420-
if (status !== local[index][service]) {
421-
changes.push({ group: what, setting: service, remote: chalk.red(status), local: chalk.green(local[index][service]) })
420+
const localValue = local[index][service];
421+
let valuesEqual = false;
422+
423+
if (Array.isArray(status) && Array.isArray(localValue)) {
424+
valuesEqual = JSON.stringify(status) === JSON.stringify(localValue);
425+
} else {
426+
valuesEqual = status === localValue;
427+
}
428+
429+
if (!valuesEqual) {
430+
changes.push({ group: what, setting: service, remote: chalk.red(status), local: chalk.green(localValue) })
422431
}
423432
}
424433
}

0 commit comments

Comments
 (0)