From 032352985bac4dd34e0af9a1f15d68dc1a7777e9 Mon Sep 17 00:00:00 2001 From: katherinehhh Date: Thu, 14 Mar 2024 21:51:48 +0800 Subject: [PATCH] refactor: view collection set name as default title when title is missing (#3719) --- .../templates/components/PreviewFields.tsx | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/packages/core/client/src/collection-manager/templates/components/PreviewFields.tsx b/packages/core/client/src/collection-manager/templates/components/PreviewFields.tsx index b3b71c560..9a2209167 100644 --- a/packages/core/client/src/collection-manager/templates/components/PreviewFields.tsx +++ b/packages/core/client/src/collection-manager/templates/components/PreviewFields.tsx @@ -84,10 +84,16 @@ const PreviewCom = (props) => { const fieldsData = Object.values(data?.data?.fields)?.map((v: any) => { if (v.source) { const option = fields?.data.find((h) => h.name === v.name) || v; - return { ...v, uiSchema: omit(option.uiSchema, 'rawTitle') }; + return { + ...v, + uiSchema: { ...omit(option.uiSchema, 'rawTitle'), title: option.uiSchema?.title || option.name }, + }; } else { const option = fields?.data.find((h) => h.name === v.name) || v; - return { ...option, uiSchema: omit(option.uiSchema, 'rawTitle') }; + return { + ...option, + uiSchema: { ...omit(option.uiSchema, 'rawTitle'), title: option.uiSchema?.title || option.name }, + }; } }); field.value = fieldsData;