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 React, { createContext, useContext, useEffect, useMemo, useRef } from 'react';
|
||||||
import { useCollection } from '../collection-manager';
|
import { useCollection } from '../collection-manager';
|
||||||
import { RecordProvider, useRecord } from '../record-provider';
|
import { RecordProvider, useRecord } from '../record-provider';
|
||||||
import { useDesignable } from '../schema-component';
|
import { useActionContext, useDesignable } from '../schema-component';
|
||||||
import { BlockProvider, useBlockRequestContext } from './BlockProvider';
|
import { BlockProvider, useBlockRequestContext } from './BlockProvider';
|
||||||
import { useActionContext } from '../schema-component';
|
|
||||||
|
|
||||||
export const FormBlockContext = createContext<any>({});
|
export const FormBlockContext = createContext<any>({});
|
||||||
|
|
||||||
@ -91,7 +90,7 @@ export const useFormBlockProps = () => {
|
|||||||
const ctx = useFormBlockContext();
|
const ctx = useFormBlockContext();
|
||||||
const record = useRecord();
|
const record = useRecord();
|
||||||
const { fieldSchema } = useActionContext();
|
const { fieldSchema } = useActionContext();
|
||||||
const { addChild } = fieldSchema?.['x-component-props']||{};
|
const addChild = fieldSchema?.['x-component-props']?.addChild;
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (addChild) {
|
if (addChild) {
|
||||||
ctx.form.query('parent').take((field) => {
|
ctx.form.query('parent').take((field) => {
|
||||||
|
@ -84,6 +84,7 @@ function getFormValues(filterByTk, field, form, fieldNames, getField, resource)
|
|||||||
return omit({ ...form.values }, keys);
|
return omit({ ...form.values }, keys);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
console.log('form.values', form.values);
|
||||||
return form.values;
|
return form.values;
|
||||||
let values = {};
|
let values = {};
|
||||||
for (const key in form.values) {
|
for (const key in form.values) {
|
||||||
@ -151,7 +152,7 @@ export const useCreateActionProps = () => {
|
|||||||
overwriteValues,
|
overwriteValues,
|
||||||
skipValidator,
|
skipValidator,
|
||||||
} = actionSchema?.['x-action-settings'] ?? {};
|
} = 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 });
|
const assignedValues = parse(originalAssignedValues)({ currentTime: new Date(), currentRecord, currentUser });
|
||||||
if (!skipValidator) {
|
if (!skipValidator) {
|
||||||
await form.submit();
|
await form.submit();
|
||||||
|
Loading…
Reference in New Issue
Block a user