fix(tree-collection): cannot read properties of undefined (reading 'addChild')
This commit is contained in:
parent
0d36caf1c0
commit
81948f4f2c
@ -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<any>({});
|
||||
|
||||
@ -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) => {
|
||||
|
@ -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();
|
||||
|
Loading…
Reference in New Issue
Block a user