From 48e32e8c4562d96b92e54e163aadcf49cb318e57 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8F=B6=E6=9E=AB?= <645381995@qq.com> Date: Thu, 30 Nov 2023 15:59:20 +0800 Subject: [PATCH] feat: cloneByNamePathList --- src/components/form/form-subscribe.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/form/form-subscribe.tsx b/src/components/form/form-subscribe.tsx index 4198378df4..b627f31e34 100644 --- a/src/components/form/form-subscribe.tsx +++ b/src/components/form/form-subscribe.tsx @@ -3,7 +3,7 @@ import type { FC, ReactNode } from 'react' import { FieldContext, useWatch } from 'rc-field-form' import type { FormInstance } from 'rc-field-form' import type { NamePath } from 'rc-field-form/es/interface' -import pick from 'lodash/pick' +import { cloneByNamePathList } from 'rc-field-form/es/utils/valueUtil' type RenderChildren = ( changedValues: Record, @@ -19,7 +19,7 @@ export interface FormSubscribeProps { export const FormSubscribe: FC = props => { const form = useContext(FieldContext) - const value = useWatch(values => pick(values, props.to), form) + const value = useWatch(values => cloneByNamePathList(values, props.to), form) // Memo to avoid useless render const childNode = React.useMemo(