From 6c00c8c68170427da2961922248e8d082b71385d Mon Sep 17 00:00:00 2001 From: Zeke Zhang <958414905@qq.com> Date: Tue, 6 Feb 2024 19:36:14 +0800 Subject: [PATCH] chore(RecordProviderV2): add parentCollectionName prop --- .../client/src/data-source/record/RecordProvider.tsx | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/packages/core/client/src/data-source/record/RecordProvider.tsx b/packages/core/client/src/data-source/record/RecordProvider.tsx index 393f9e03d5..80e045fff8 100644 --- a/packages/core/client/src/data-source/record/RecordProvider.tsx +++ b/packages/core/client/src/data-source/record/RecordProvider.tsx @@ -13,6 +13,10 @@ export interface RecordProviderPropsV2 { * 当前记录所属的 collection name */ collectionName?: string; + /** + * 当前记录所属的父级 collection name + */ + parentCollectionName?: string; } export const RecordProviderV2: FC = ({ @@ -21,14 +25,15 @@ export const RecordProviderV2: FC = ({ parentRecord, children, collectionName, + parentCollectionName, }) => { const parentRecordValue = useMemo(() => { if (parentRecord) { if (parentRecord instanceof RecordV2) return parentRecord; - return new RecordV2({ data: parentRecord, collectionName }); + return new RecordV2({ data: parentRecord, collectionName: parentCollectionName }); } if (record instanceof RecordV2) return record.parentRecord; - }, [collectionName, parentRecord, record]); + }, [parentCollectionName, parentRecord, record]); const currentRecordValue = useMemo(() => { let res: RecordV2;