fix: association block was not associated after adding data (#2907)
This commit is contained in:
parent
568b12a537
commit
108453f90c
@ -64,6 +64,7 @@ const useResource = (props: UseResourceProps) => {
|
||||
const { fieldSchema } = useActionContext();
|
||||
const isCreateAction = fieldSchema?.['x-action'] === 'create';
|
||||
const association = useAssociation(props);
|
||||
console.log(association);
|
||||
const sourceId = useSourceId?.();
|
||||
const field = useField();
|
||||
const withoutTableFieldResource = useContext(WithoutTableFieldResource);
|
||||
@ -96,6 +97,9 @@ const useResource = (props: UseResourceProps) => {
|
||||
if (record[association?.sourceKey || 'id']) {
|
||||
return api.resource(resource, record[association?.sourceKey || 'id']);
|
||||
}
|
||||
if (record?.__parent?.[association?.sourceKey || 'id']) {
|
||||
return api.resource(resource, record.__parent[association?.sourceKey || 'id']);
|
||||
}
|
||||
return api.resource(collection);
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user