mirror of
https://github.com/nocobase/nocobase
synced 2024-11-15 11:36:42 +00:00
fix: tableField query data in add child action (#1876)
This commit is contained in:
parent
49117afb72
commit
0086037425
@ -51,6 +51,8 @@ const useResource = (props: UseResourceProps) => {
|
||||
const { block, resource, useSourceId } = props;
|
||||
const record = useRecord();
|
||||
const api = useAPIClient();
|
||||
const { fieldSchema } = useActionContext();
|
||||
const isCreateAction = fieldSchema?.['x-action'] === 'create';
|
||||
const association = useAssociation(props);
|
||||
const sourceId = useSourceId?.();
|
||||
const field = useField<Field>();
|
||||
@ -59,7 +61,9 @@ const useResource = (props: UseResourceProps) => {
|
||||
field,
|
||||
api,
|
||||
resource,
|
||||
sourceId: sourceId || record[association?.sourceKey || 'id'] || record?.__parent?.[association?.sourceKey || 'id'],
|
||||
sourceId: !isCreateAction
|
||||
? sourceId || record[association?.sourceKey || 'id'] || record?.__parent?.[association?.sourceKey || 'id']
|
||||
: undefined,
|
||||
};
|
||||
return new TableFieldResource(options);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user