From 44eadc5f3e61bae233daf946060be41b223449d1 Mon Sep 17 00:00:00 2001 From: Leonardo Giacone Date: Wed, 19 Jun 2024 12:10:50 +0200 Subject: [PATCH] fix(ui): convert cell values to string for rendering --- packages/ui/src/DataTable/DataTable.tsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/ui/src/DataTable/DataTable.tsx b/packages/ui/src/DataTable/DataTable.tsx index 33487b0c0c3..bb23a3cced9 100644 --- a/packages/ui/src/DataTable/DataTable.tsx +++ b/packages/ui/src/DataTable/DataTable.tsx @@ -215,7 +215,11 @@ const defineColumns = ( if (cell && typeof cell === "function") { return cell(info.row.original); } else { - return info.getValue() || null; + // Automatically convert any cell value to a string for rendering, + // ensuring the table displays values correctly. This aligns with React's + // rendering, which expects JSX, strings or null. + // https://github.com/TanStack/table/issues/1042 + return info.getValue() ? String(info.getValue()) : null; } }, enableSorting,