From f93110f3793995866b0e4c24a756e5a8f03e22b8 Mon Sep 17 00:00:00 2001 From: imanjra Date: Wed, 23 Oct 2024 08:47:23 -0400 Subject: [PATCH] fix conditional row action artifact --- .../plugins/SchemaIO/components/TableView.tsx | 68 ++++++++++--------- 1 file changed, 37 insertions(+), 31 deletions(-) diff --git a/app/packages/core/src/plugins/SchemaIO/components/TableView.tsx b/app/packages/core/src/plugins/SchemaIO/components/TableView.tsx index 89747ad9ab..30bab63496 100644 --- a/app/packages/core/src/plugins/SchemaIO/components/TableView.tsx +++ b/app/packages/core/src/plugins/SchemaIO/components/TableView.tsx @@ -123,38 +123,44 @@ export default function TableView(props: ViewPropsType) { - {rows.map((item, rowIndex) => ( - - {columns.map(({ key }, columnIndex) => { - const coordinate = [rowIndex, columnIndex].join(","); - const isSelected = - selectedCells.has(coordinate) || - selectedRows.has(rowIndex) || - selectedColumns.has(columnIndex); - return ( - { - handleCellClick(rowIndex, columnIndex); - }} - {...getComponentProps(props, "tableBodyCell")} - > - {formatCellValue(item[key], props)} + {rows.map((item, rowIndex) => { + const rowActions = getRowActions(rowIndex); + const currentRowHasActions = rowActions?.length > 0; + return ( + + {columns.map(({ key }, columnIndex) => { + const coordinate = [rowIndex, columnIndex].join(","); + const isSelected = + selectedCells.has(coordinate) || + selectedRows.has(rowIndex) || + selectedColumns.has(columnIndex); + return ( + { + handleCellClick(rowIndex, columnIndex); + }} + {...getComponentProps(props, "tableBodyCell")} + > + {formatCellValue(item[key], props)} + + ); + })} + {hasRowActions && ( + + {currentRowHasActions && ( + + )} - ); - })} - {hasRowActions && ( - - - - )} - - ))} + )} + + ); + })}