diff --git a/packages/core/client/src/block-provider/hooks/index.ts b/packages/core/client/src/block-provider/hooks/index.ts index 2c55b3c2d..5717dae9b 100644 --- a/packages/core/client/src/block-provider/hooks/index.ts +++ b/packages/core/client/src/block-provider/hooks/index.ts @@ -49,11 +49,17 @@ export const useCreateActionProps = () => { if (fieldNames.includes(key)) { const items = form.values[key]; const collectionField = getField(key); - const targetKey = collectionField.targetKey || 'id'; - if (Array.isArray(items)) { - values[key] = items.map((item) => item[targetKey]); - } else if (items && typeof items === 'object') { - values[key] = items[targetKey]; + if (collectionField.interface === 'linkTo') { + const targetKey = collectionField.targetKey || 'id'; + if (Array.isArray(items)) { + values[key] = items.map((item) => item[targetKey]); + } else if (items && typeof items === 'object') { + values[key] = items[targetKey]; + } else { + values[key] = items[targetKey]; + } + } else { + values[key] = form.values[key]; } } else { values[key] = form.values[key]; @@ -118,6 +124,8 @@ export const useUpdateActionProps = () => { values[key] = items.map((item) => item[targetKey]); } else if (items && typeof items === 'object') { values[key] = items[targetKey]; + } else { + values[key] = items[targetKey]; } } else { values[key] = form.values[key];