From 8e11e8d364132826f58922da797fdf7bc6bcbeaf Mon Sep 17 00:00:00 2001 From: Junyi Date: Sun, 17 Apr 2022 18:09:46 +0800 Subject: [PATCH] fix(client): avoid cannot getField by randomly generated name and throw error (#294) Co-authored-by: chenos --- .../antd/record-picker/ReadPrettyRecordPicker.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/core/client/src/schema-component/antd/record-picker/ReadPrettyRecordPicker.tsx b/packages/core/client/src/schema-component/antd/record-picker/ReadPrettyRecordPicker.tsx index 7abb842c4..f118d8c32 100644 --- a/packages/core/client/src/schema-component/antd/record-picker/ReadPrettyRecordPicker.tsx +++ b/packages/core/client/src/schema-component/antd/record-picker/ReadPrettyRecordPicker.tsx @@ -18,7 +18,7 @@ export const ReadPrettyRecordPicker: React.FC = observer((props: any) => { const { getField } = useCollection(); const collectionField = getField(fieldSchema.name); const [record, setRecord] = useState({}); - return ( + return collectionField ? (
@@ -48,5 +48,5 @@ export const ReadPrettyRecordPicker: React.FC = observer((props: any) => {
- ); + ) : null; });