Skip to content

Commit 1ebd1aa

Browse files
Ducicatmorrell
authored andcommitted
fix: custom fields serialization
1 parent 0592bf8 commit 1ebd1aa

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

invenio_communities/assets/semantic-ui/js/invenio_communities/settings/profile/CustomFieldSerializer.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,9 @@ export class CustomFieldSerializer {
5252
if (isVocabulary && value?.id) {
5353
return value.id;
5454
}
55-
// Add __key if i is passed i.e is an array. This is needed because of ArrayField
56-
// internal implementation
57-
if (i) value.__key = i;
55+
// only assign __key when we're iterating an array (Number.isInteger(i)) and the element is a plain object (not a string or other primitive).
56+
if (Number.isInteger(i) && typeof value === "object" && value !== null)
57+
value.__key = i;
5858
return value;
5959
};
6060
const _record = _cloneDeep(record);

0 commit comments

Comments
 (0)