Commit afa46632 authored by Benjamin Bouvier's avatar Benjamin Bouvier
Browse files

Fixes #569: Do a deep copy of custom fields in the Bank ctor;

parent cb2a2687
......@@ -13,7 +13,9 @@ export class Bank {
this.name = assertHas(arg, 'name') && arg.name;
this.uuid = assertHas(arg, 'uuid') && arg.uuid;
this.id = this.uuid;
this.customFields = arg.customFields || [];
// Force a deep copy of the custom fields (see also issue #569).
this.customFields = JSON.parse(JSON.stringify(arg.customFields || []));
}
}
......
......@@ -995,10 +995,12 @@ function sortSelectFields(field) {
function sortBanks(banks) {
banks.sort((a, b) => localeComparator(a.name, b.name));
// Sort the selects of customFields by alphabetical order.
banks.forEach(bank => {
if (bank.customFields)
if (bank.customFields) {
bank.customFields.forEach(sortSelectFields);
}
});
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment