From 75cc36240951153d200241eb00bfc9991e9258c0 Mon Sep 17 00:00:00 2001 From: anovazzi1 Date: Thu, 27 Jun 2024 13:59:13 -0300 Subject: [PATCH 1/2] 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) => ({ From 248560b3ef9de79671b7b5ff9dc3df64de34b7cc Mon Sep 17 00:00:00 2001 From: anovazzi1 Date: Thu, 27 Jun 2024 14:00:46 -0300 Subject: [PATCH 2/2] format code --- src/frontend/src/components/dataOutputComponent/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/frontend/src/components/dataOutputComponent/index.tsx b/src/frontend/src/components/dataOutputComponent/index.tsx index 5fe4d3637..cc42be4e3 100644 --- a/src/frontend/src/components/dataOutputComponent/index.tsx +++ b/src/frontend/src/components/dataOutputComponent/index.tsx @@ -14,7 +14,7 @@ function DataOutputComponent({ 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")) { + if (rows.some((row) => typeof row !== "object")) { rows = rows.map((row) => ({ data: row })); }