From 71f3bfcf51f48191e82385201735939cf719a136 Mon Sep 17 00:00:00 2001 From: anovazzi1 Date: Thu, 27 Jun 2024 13:59:13 -0300 Subject: [PATCH] feat: convert non-object rows to array of objects in DataOutputComponent --- src/frontend/src/components/dataOutputComponent/index.tsx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/frontend/src/components/dataOutputComponent/index.tsx b/src/frontend/src/components/dataOutputComponent/index.tsx index 9a3b2f66d..5fe4d3637 100644 --- a/src/frontend/src/components/dataOutputComponent/index.tsx +++ b/src/frontend/src/components/dataOutputComponent/index.tsx @@ -10,9 +10,14 @@ function DataOutputComponent({ columnMode = "union", }: { pagination: boolean; - rows: any; + rows: any[]; columnMode?: "intersection" | "union"; }) { + // If the rows are not an array of objects, convert them to an array of objects + if(rows.some((row) => typeof row !== "object")) { + rows = rows.map((row) => ({ data: row })); + } + const columns = extractColumnsFromRows(rows, columnMode); const columnDefs = columns.map((col, idx) => ({