diff --git a/packages/core/client/src/block-provider/BlockProvider.tsx b/packages/core/client/src/block-provider/BlockProvider.tsx index 15f3290fa..c555b473b 100644 --- a/packages/core/client/src/block-provider/BlockProvider.tsx +++ b/packages/core/client/src/block-provider/BlockProvider.tsx @@ -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(); @@ -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); }