Skip to content

Commit e22bd3c

Browse files
Adebesin-Cellclaude
andcommitted
fix: avoid spread into push for large batch results
Use nested for...of instead of push(...results.flat()) to avoid exceeding max function arguments for large orgs. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 2f85269 commit e22bd3c

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

app/composables/npm/useAlgoliaSearch.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,11 @@ export function useAlgoliaSearch() {
260260
for (let i = 0; i < batches.length; i += CONCURRENCY) {
261261
const chunk = batches.slice(i, i + CONCURRENCY)
262262
const results = await Promise.all(chunk.map(batch => getPackagesByNameSlice(batch)))
263-
allObjects.push(...results.flat())
263+
for (const result of results) {
264+
for (const pkg of result) {
265+
allObjects.push(pkg)
266+
}
267+
}
264268
}
265269

266270
return {

0 commit comments

Comments
 (0)