fix: should shadow merge

This commit is contained in:
sealday 2024-04-03 19:37:19 +08:00
parent 4a0575985e
commit 7d500fe1c9

View File

@ -1,5 +1,4 @@
import { useExpressionScope } from '@nocobase/schema'; import { useExpressionScope } from '@nocobase/schema';
import { merge, omit } from 'lodash';
import React, { ComponentType, useMemo } from 'react'; import React, { ComponentType, useMemo } from 'react';
import { useDesignable } from '../../schema-component'; import { useDesignable } from '../../schema-component';
@ -41,7 +40,7 @@ export function withDynamicSchemaProps<T = any>(Component: any, options: WithSch
const schemaProps = useSchemaProps(props); const schemaProps = useSchemaProps(props);
const memoProps = useMemo(() => { const memoProps = useMemo(() => {
return merge(omit(props, 'children'), omit(schemaProps, 'children')); return { ...props, ...schemaProps };
}, [schemaProps, props]); }, [schemaProps, props]);
return <Component {...memoProps}>{props.children}</Component>; return <Component {...memoProps}>{props.children}</Component>;