Skip to content

Commit 97e3d45

Browse files
authored
fix(medic#10792): replace spread operator with for..of loop in authorization service (medic#10793)
Fixes issue where extremely large document id arrays could not be spread pushed. closes medic#10792
1 parent 2822046 commit 97e3d45

1 file changed

Lines changed: 9 additions & 7 deletions

File tree

api/src/services/authorization.js

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -638,13 +638,15 @@ const getDocsByReplicationKeyNouveau = async (authorizationContext) => {
638638
continue;
639639
}
640640

641-
hits.push(...response.hits.map(hit => ({
642-
id: hit.id,
643-
fields: {
644-
...hit.fields,
645-
key: Array.isArray(hit.fields.key) ? hit.fields.key : [hit.fields.key],
646-
},
647-
})));
641+
for (const hit of response.hits) {
642+
hits.push({
643+
id: hit.id,
644+
fields: {
645+
...hit.fields,
646+
key: Array.isArray(hit.fields.key) ? hit.fields.key : [hit.fields.key],
647+
},
648+
});
649+
}
648650
}
649651

650652
return hits;

0 commit comments

Comments
 (0)