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