Skip to content

🪢 Open source agent evals & observability: Trace, evaluate, and improve LLM applications with one open platform.

fix(pretty-json-view): prevent spread operator stack overflow (#9983)

marliessophie4b5e9372eb56
diff --git a/web/src/components/ui/PrettyJsonView.tsx b/web/src/components/ui/PrettyJsonView.tsx
index 27220ceae2..4e9c33c4f2 100644
--- a/web/src/components/ui/PrettyJsonView.tsx
+++ b/web/src/components/ui/PrettyJsonView.tsx
@@ -273,7 +273,7 @@ function findOptimalExpansionLevel(
}
// Get all children for next level
- const childRows: JsonTableRow[] = [];
+ let childRows: JsonTableRow[] = [];
for (const row of rows) {
if (row.hasChildren && row.rawChildData) {
@@ -290,7 +290,8 @@ function findOptimalExpansionLevel(
visitedData.add(row.rawChildData);
const children = getRowChildren(row);
- childRows.push(...children);
+ // Use concat instead of spread to avoid stack overflow with large arrays
+ childRows = childRows.concat(children);
}
}