fix: association field display has been delete in sub-form (#2205)
This commit is contained in:
parent
6646007dd7
commit
09d5477983
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user