mirror of
https://github.com/nocobase/nocobase
synced 2024-11-15 07:25:15 +00:00
Merge branch 'main' into next
Some checks are pending
Build Docker Image / build-and-push (push) Waiting to run
Build Pro Image / build-and-push (push) Waiting to run
E2E / Build (push) Waiting to run
E2E / Core and plugins (push) Blocked by required conditions
E2E / plugin-workflow (push) Blocked by required conditions
E2E / plugin-workflow-approval (push) Blocked by required conditions
E2E / plugin-data-source-main (push) Blocked by required conditions
E2E / Comment on PR (push) Blocked by required conditions
NocoBase FrontEnd Test / frontend-test (18) (push) Waiting to run
Some checks are pending
Build Docker Image / build-and-push (push) Waiting to run
Build Pro Image / build-and-push (push) Waiting to run
E2E / Build (push) Waiting to run
E2E / Core and plugins (push) Blocked by required conditions
E2E / plugin-workflow (push) Blocked by required conditions
E2E / plugin-workflow-approval (push) Blocked by required conditions
E2E / plugin-data-source-main (push) Blocked by required conditions
E2E / Comment on PR (push) Blocked by required conditions
NocoBase FrontEnd Test / frontend-test (18) (push) Waiting to run
This commit is contained in:
commit
7ee6eac0f7
@ -7,7 +7,7 @@
|
||||
* For more information, please refer to: https://www.nocobase.com/agreement.
|
||||
*/
|
||||
|
||||
import { createForm } from '@formily/core';
|
||||
import { createForm, Form } from '@formily/core';
|
||||
import { Schema, useField } from '@formily/react';
|
||||
import { Spin } from 'antd';
|
||||
import React, { createContext, useContext, useEffect, useMemo, useRef } from 'react';
|
||||
@ -165,7 +165,13 @@ export const useFormBlockProps = () => {
|
||||
|
||||
useEffect(() => {
|
||||
if (!ctx?.service?.loading) {
|
||||
ctx.form?.setInitialValues(ctx.service?.data?.data);
|
||||
const form: Form = ctx.form;
|
||||
if (form) {
|
||||
// form 字段中可能一开始就存在一些默认值(比如设置了字段默认值的模板区块)。在编辑表单中,
|
||||
// 这些默认值是不需要的,需要清除掉,不然会导致一些问题。比如:https://github.com/nocobase/nocobase/issues/4868
|
||||
form.initialValues = {};
|
||||
form.setInitialValues(ctx.service?.data?.data);
|
||||
}
|
||||
}
|
||||
}, [ctx?.service?.loading]);
|
||||
return {
|
||||
|
@ -55,7 +55,7 @@ const InternalAssociationSelect = observer(
|
||||
const { objectValue = true, addMode: propsAddMode, ...rest } = props;
|
||||
const field: any = useField();
|
||||
const fieldSchema = useFieldSchema();
|
||||
const service = useServiceOptions(props);
|
||||
const service = useServiceOptions(fieldSchema?.['x-component-props'] || props);
|
||||
const { options: collectionField } = useAssociationFieldContext();
|
||||
const initValue = isVariable(props.value) ? undefined : props.value;
|
||||
const value = Array.isArray(initValue) ? initValue.filter(Boolean) : initValue;
|
||||
|
Loading…
Reference in New Issue
Block a user