fix: useRecord (#2911)
This commit is contained in:
parent
d492471ed5
commit
101e1f8f97
@ -43,7 +43,6 @@ const InternalFormBlockProvider = (props) => {
|
|||||||
if (service.loading && Object.keys(form?.initialValues)?.length === 0 && action) {
|
if (service.loading && Object.keys(form?.initialValues)?.length === 0 && action) {
|
||||||
return <Spin />;
|
return <Spin />;
|
||||||
}
|
}
|
||||||
|
|
||||||
let content = (
|
let content = (
|
||||||
<div ref={formBlockRef}>
|
<div ref={formBlockRef}>
|
||||||
<RenderChildrenWithDataTemplates form={form} />
|
<RenderChildrenWithDataTemplates form={form} />
|
||||||
@ -97,7 +96,6 @@ export const FormBlockProvider = (props) => {
|
|||||||
if (isDetailBlock) {
|
if (isDetailBlock) {
|
||||||
detailFlag = true;
|
detailFlag = true;
|
||||||
if (!designable && __collection) {
|
if (!designable && __collection) {
|
||||||
console.log(__collection === collection);
|
|
||||||
detailFlag = __collection === collection;
|
detailFlag = __collection === collection;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -127,7 +125,7 @@ export const useFormBlockProps = () => {
|
|||||||
if (addChild) {
|
if (addChild) {
|
||||||
ctx.form?.query('parent').take((field) => {
|
ctx.form?.query('parent').take((field) => {
|
||||||
field.disabled = true;
|
field.disabled = true;
|
||||||
field.value = new Proxy({ ...record }, {});
|
field.value = new Proxy({ ...record?.__parent }, {});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -205,8 +205,8 @@ export const useCreateActionProps = () => {
|
|||||||
// const values = omitBy(formValues, (value) => isEqual(JSON.stringify(value), '[{}]'));
|
// const values = omitBy(formValues, (value) => isEqual(JSON.stringify(value), '[{}]'));
|
||||||
if (addChild) {
|
if (addChild) {
|
||||||
const treeParentField = getTreeParentField();
|
const treeParentField = getTreeParentField();
|
||||||
values[treeParentField?.name ?? 'parent'] = currentRecord;
|
values[treeParentField?.name ?? 'parent'] = currentRecord?.__parent;
|
||||||
values[treeParentField?.foreignKey ?? 'parentId'] = currentRecord.id;
|
values[treeParentField?.foreignKey ?? 'parentId'] = currentRecord?.__parent?.id;
|
||||||
}
|
}
|
||||||
actionField.data = field.data || {};
|
actionField.data = field.data || {};
|
||||||
actionField.data.loading = true;
|
actionField.data.loading = true;
|
||||||
|
Loading…
Reference in New Issue
Block a user