From f020a7ec7c57af73a2c593c813b4caf84af150a8 Mon Sep 17 00:00:00 2001 From: smoothdvd Date: Tue, 7 Jan 2025 20:01:43 +0800 Subject: [PATCH] fix(JSONCell): Improve JSON data handling and display Improve text truncation logic --- .../ui/src/elements/Table/DefaultCell/fields/JSON/index.tsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/ui/src/elements/Table/DefaultCell/fields/JSON/index.tsx b/packages/ui/src/elements/Table/DefaultCell/fields/JSON/index.tsx index 938f02bd832..0f3b9af7c51 100644 --- a/packages/ui/src/elements/Table/DefaultCell/fields/JSON/index.tsx +++ b/packages/ui/src/elements/Table/DefaultCell/fields/JSON/index.tsx @@ -6,11 +6,12 @@ import React from 'react' import './index.scss' export const JSONCell: React.FC> = ({ cellData }) => { - const textToShow = cellData?.length > 100 ? `${cellData.substring(0, 100)}\u2026` : cellData + const stringData = cellData ? JSON.stringify(cellData) : cellData + const textToShow = stringData?.length > 100 ? `${stringData.substring(0, 100)}\u2026` : stringData return ( - {JSON.stringify(textToShow)} + {textToShow} ) }