diff --git a/packages/core/client/src/block-provider/FormBlockProvider.tsx b/packages/core/client/src/block-provider/FormBlockProvider.tsx index 35b336048..c9ac36994 100644 --- a/packages/core/client/src/block-provider/FormBlockProvider.tsx +++ b/packages/core/client/src/block-provider/FormBlockProvider.tsx @@ -5,9 +5,8 @@ import isEmpty from 'lodash/isEmpty'; import React, { createContext, useContext, useEffect, useMemo, useRef } from 'react'; import { useCollection } from '../collection-manager'; import { RecordProvider, useRecord } from '../record-provider'; -import { useDesignable } from '../schema-component'; +import { useActionContext, useDesignable } from '../schema-component'; import { BlockProvider, useBlockRequestContext } from './BlockProvider'; -import { useActionContext } from '../schema-component'; export const FormBlockContext = createContext({}); @@ -91,7 +90,7 @@ export const useFormBlockProps = () => { const ctx = useFormBlockContext(); const record = useRecord(); const { fieldSchema } = useActionContext(); - const { addChild } = fieldSchema?.['x-component-props']||{}; + const addChild = fieldSchema?.['x-component-props']?.addChild; useEffect(() => { if (addChild) { ctx.form.query('parent').take((field) => { diff --git a/packages/core/client/src/block-provider/hooks/index.ts b/packages/core/client/src/block-provider/hooks/index.ts index fd8a848c1..edfd3361e 100644 --- a/packages/core/client/src/block-provider/hooks/index.ts +++ b/packages/core/client/src/block-provider/hooks/index.ts @@ -84,6 +84,7 @@ function getFormValues(filterByTk, field, form, fieldNames, getField, resource) return omit({ ...form.values }, keys); } } + console.log('form.values', form.values); return form.values; let values = {}; for (const key in form.values) { @@ -151,7 +152,7 @@ export const useCreateActionProps = () => { overwriteValues, skipValidator, } = actionSchema?.['x-action-settings'] ?? {}; - const { addChild } = fieldSchema?.['x-component-props']; + const addChild = fieldSchema?.['x-component-props']?.addChild; const assignedValues = parse(originalAssignedValues)({ currentTime: new Date(), currentRecord, currentUser }); if (!skipValidator) { await form.submit();