Skip to content

Commit

Permalink
feat: cloneByNamePathList
Browse files Browse the repository at this point in the history
  • Loading branch information
crazyair committed Nov 30, 2023
1 parent 23ae163 commit 48e32e8
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/components/form/form-subscribe.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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<Values = any> = (
changedValues: Record<string, any>,
Expand All @@ -19,7 +19,7 @@ export interface FormSubscribeProps {
export const FormSubscribe: FC<FormSubscribeProps> = 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(
Expand Down

0 comments on commit 48e32e8

Please sign in to comment.