From e7d60389b9285134b3ca10107b0709f7a8eca3b2 Mon Sep 17 00:00:00 2001 From: katherinehhh Date: Fri, 1 Sep 2023 18:54:27 +0800 Subject: [PATCH] fix: association block report error for toOne association field (#2582) --- packages/core/client/src/block-provider/BlockProvider.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/core/client/src/block-provider/BlockProvider.tsx b/packages/core/client/src/block-provider/BlockProvider.tsx index 462df68f3..2ee77cb3e 100644 --- a/packages/core/client/src/block-provider/BlockProvider.tsx +++ b/packages/core/client/src/block-provider/BlockProvider.tsx @@ -345,6 +345,9 @@ export const useParamsFromRecord = () => { const filterByTk = useFilterByTk(); const record = useRecord(); const { fields } = useCollection(); + const fieldSchema = useFieldSchema(); + const { getCollectionJoinField } = useCollectionManager(); + const collectionField = getCollectionJoinField(fieldSchema?.['x-decorator-props']?.resource); const filterFields = fields .filter((v) => { return ['boolean', 'date', 'integer', 'radio', 'sort', 'string', 'time', 'uid', 'uuid'].includes(v.type); @@ -360,7 +363,7 @@ export const useParamsFromRecord = () => { const obj = { filterByTk: filterByTk, }; - if (record.__collection) { + if (record.__collection && !['oho', 'm2o', 'obo'].includes(collectionField?.interface)) { obj['targetCollection'] = record.__collection; } if (!filterByTk) {