From 09d547798335a1ebadcf73cbc18e945e6aa834fe Mon Sep 17 00:00:00 2001 From: katherinehhh Date: Fri, 7 Jul 2023 13:57:12 +0800 Subject: [PATCH] fix: association field display has been delete in sub-form (#2205) --- .../src/collection-manager/CollectionFieldProvider.tsx | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/packages/core/client/src/collection-manager/CollectionFieldProvider.tsx b/packages/core/client/src/collection-manager/CollectionFieldProvider.tsx index b0275af3a..aec1f6496 100644 --- a/packages/core/client/src/collection-manager/CollectionFieldProvider.tsx +++ b/packages/core/client/src/collection-manager/CollectionFieldProvider.tsx @@ -1,6 +1,5 @@ import { SchemaKey, useFieldSchema } from '@formily/react'; import React from 'react'; -import { useRecord } from '../record-provider'; import { CollectionFieldContext } from './context'; import { useCollection, useCollectionManager } from './hooks'; import { CollectionFieldOptions } from './types'; @@ -13,11 +12,8 @@ export const CollectionFieldProvider: React.FC<{ const { name, field, children, fallback = null } = props; const fieldSchema = useFieldSchema(); const { getField } = useCollection(); - const { __collection } = useRecord(); const { getCollectionJoinField } = useCollectionManager(); - const value = __collection - ? getCollectionJoinField(`${__collection}.${name}`) - : field || getField(field?.name || name) || getCollectionJoinField(fieldSchema?.['x-collection-field']); + const value = field || getField(field?.name || name) || getCollectionJoinField(fieldSchema?.['x-collection-field']); if (!value) { return fallback; }