mirror of
https://github.com/nocobase/nocobase
synced 2024-11-15 09:47:10 +00:00
Merge branch 'main' into next
Some checks failed
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) Has been cancelled
Some checks failed
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) Has been cancelled
This commit is contained in:
commit
6f788ccb4f
@ -151,7 +151,7 @@ export const useFormBlockContext = () => {
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
export const useFormBlockProps = () => {
|
||||
export const useFormBlockProps = (shouldClearInitialValues = false) => {
|
||||
const ctx = useFormBlockContext();
|
||||
const treeParentRecord = useTreeParentRecord();
|
||||
useEffect(() => {
|
||||
@ -169,7 +169,9 @@ export const useFormBlockProps = () => {
|
||||
if (form) {
|
||||
// form 字段中可能一开始就存在一些默认值(比如设置了字段默认值的模板区块)。在编辑表单中,
|
||||
// 这些默认值是不需要的,需要清除掉,不然会导致一些问题。比如:https://github.com/nocobase/nocobase/issues/4868
|
||||
form.initialValues = {};
|
||||
if (shouldClearInitialValues) {
|
||||
form.initialValues = {};
|
||||
}
|
||||
form.setInitialValues(ctx.service?.data?.data);
|
||||
}
|
||||
}
|
||||
|
@ -10,5 +10,5 @@
|
||||
import { useFormBlockProps } from '../../../../../block-provider/FormBlockProvider';
|
||||
|
||||
export function useEditFormBlockProps() {
|
||||
return useFormBlockProps();
|
||||
return useFormBlockProps(true);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user