mirror of
https://gitee.com/nocobase/nocobase.git
synced 2025-05-05 13:39:24 +08:00
Merge branch 'main' into next
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…
x
Reference in New Issue
Block a user