From fc5f10b8060eb90be6b7bfcd49e4cc907fe26c70 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8F=A4=E6=9C=88?= <17949154+yazhouio@users.noreply.github.com> Date: Tue, 10 Dec 2024 16:52:01 +0800 Subject: [PATCH] fix: handle null rendering in BaseDataTable cell (#321) * fix: handle null rendering in BaseDataTable cell Signed-off-by: ya zhou * refactor: remove unused styled-components import in DataTable Signed-off-by: ya zhou * ci: update version Signed-off-by: ya zhou --------- Signed-off-by: ya zhou --- .changeset/wise-garlics-hang.md | 13 +++++++++++++ .../components/src/Table/DataTable/BaseTable.tsx | 2 +- packages/components/src/Table/DataTable/Table.tsx | 1 - 3 files changed, 14 insertions(+), 2 deletions(-) create mode 100644 .changeset/wise-garlics-hang.md diff --git a/.changeset/wise-garlics-hang.md b/.changeset/wise-garlics-hang.md new file mode 100644 index 00000000..9d1c2ed9 --- /dev/null +++ b/.changeset/wise-garlics-hang.md @@ -0,0 +1,13 @@ +--- +'@kubed/code-editor': patch +'@kubed/diff-viewer': patch +'@kubed/components': patch +'@kubed/log-viewer': patch +'@kubed/charts': patch +'@kubed/hooks': patch +'@kubed/icons': patch +'@kubed/tests': patch +'kubed-documents': patch +--- + +fix: handle null rendering in BaseDataTable cell diff --git a/packages/components/src/Table/DataTable/BaseTable.tsx b/packages/components/src/Table/DataTable/BaseTable.tsx index 0f9080a7..7b6b77ab 100644 --- a/packages/components/src/Table/DataTable/BaseTable.tsx +++ b/packages/components/src/Table/DataTable/BaseTable.tsx @@ -65,7 +65,7 @@ export function BaseDataTable({ table }: BaseDataTableProps) { {...(getTdProps && getTdProps(table, cell.getContext()))} {...(cell.column.columnDef.meta?.td ?? {})} > - {flexRender(cell.column.columnDef.cell, cell.getContext())} + {flexRender(cell.column.columnDef.cell, cell.getContext()) ?? null} ))} diff --git a/packages/components/src/Table/DataTable/Table.tsx b/packages/components/src/Table/DataTable/Table.tsx index 06d8e849..0197a04a 100644 --- a/packages/components/src/Table/DataTable/Table.tsx +++ b/packages/components/src/Table/DataTable/Table.tsx @@ -1,7 +1,6 @@ import type { Header, Row, RowData, Table, TableState } from '@tanstack/react-table'; import cx from 'classnames'; import * as React from 'react'; -import styled from 'styled-components'; import * as BaseTable from '../BaseTable'; import { BaseDataTable } from './BaseTable'; import { Pagination, TableFooter } from './Pagination';