Skip to content

Commit

Permalink
preferences: fix merge of array values
Browse files Browse the repository at this point in the history
Merged arrays should contain only unique values.
  • Loading branch information
AlexandraBuzila committed Feb 9, 2023
1 parent 120d1a3 commit eb8d246
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/core/src/browser/preferences/preference-provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,8 @@ export abstract class PreferenceProvider implements Disposable {
this.merge(source[key], value);
continue;
} else if (JSONExt.isArray(source[key]) && JSONExt.isArray(value)) {
source[key] = [...JSONExt.deepCopy(source[key] as any), ...JSONExt.deepCopy(value)];
const uniqueValues = new Set([...value, ...(source[key] as any)].map(v => JSON.stringify(v)));
source[key] = Array.from(uniqueValues).map(v => JSON.parse(v));
continue;
}
}
Expand Down

0 comments on commit eb8d246

Please sign in to comment.