From 729f12d02e96ddb4a19d2cf32ea74e7ea0056004 Mon Sep 17 00:00:00 2001 From: anovazzi1 Date: Tue, 4 Jun 2024 15:18:34 -0300 Subject: [PATCH] fix(recordsOutputComponent): set default value for columnMode prop to "union" to prevent potential issues with missing prop fix(utils.ts): set default value for mode parameter in extractColumnsFromRows function to "union" to ensure consistent behavior and prevent errors --- .../src/components/recordsOutputComponent/index.tsx | 4 ++-- src/frontend/src/utils/utils.ts | 6 ++---- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/src/frontend/src/components/recordsOutputComponent/index.tsx b/src/frontend/src/components/recordsOutputComponent/index.tsx index 65c86e859..fb4bec505 100644 --- a/src/frontend/src/components/recordsOutputComponent/index.tsx +++ b/src/frontend/src/components/recordsOutputComponent/index.tsx @@ -7,12 +7,12 @@ import TableComponent from "../tableComponent"; function RecordsOutputComponent({ pagination, rows, - columnMode, + columnMode = "union", columnDefsRow, }: { pagination: boolean; rows: any; - columnMode: "intersection" | "union" | "all"; + columnMode?: "intersection" | "union"; columnDefsRow?: Array; }) { const columns = extractColumnsFromRows(columnDefsRow ?? rows, columnMode); diff --git a/src/frontend/src/utils/utils.ts b/src/frontend/src/utils/utils.ts index 1b75212b3..b50bdbaad 100644 --- a/src/frontend/src/utils/utils.ts +++ b/src/frontend/src/utils/utils.ts @@ -351,7 +351,7 @@ export function isTimeStampString(str: string): boolean { export function extractColumnsFromRows( rows: object[], - mode: "intersection" | "union" | "all", + mode: "intersection" | "union" = "union", ): (ColDef | ColGroupDef)[] { const columnsKeys: { [key: string]: ColDef | ColGroupDef } = {}; if (rows.length === 0) { @@ -391,10 +391,8 @@ export function extractColumnsFromRows( if (mode === "intersection") { intersection(); - } else if (mode === "union") { - union(); } else { - return rows; + union(); } return Object.values(columnsKeys);