Skip to content

Commit

Permalink
fix: Form change trigger
Browse files Browse the repository at this point in the history
  • Loading branch information
shaodahong committed Nov 13, 2020
1 parent efd9990 commit d1da4ba
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions components/form/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ const InternalForm: ForwardRefRenderFunction<FormInstance, FormProps> = (
layoutCol = { span: 24 },
initialValues: initialValuesInternal,
placeholder: placeholderInternal = '-',
onValuesChange: onValuesChangeInternal,
onFieldsChange: onFieldsChangeInternal,
mode,
cardProps,
childrenProps,
Expand Down Expand Up @@ -341,10 +341,10 @@ const InternalForm: ForwardRefRenderFunction<FormInstance, FormProps> = (
)
}

const onValuesChange = (changeValues: Store, values: Store) => {
const onFieldsChange = (changedFields: any[], allFields: any[]) => {
forceUpdate()
isFunc(onValuesChangeInternal) &&
onValuesChangeInternal(changeValues, values)
isFunc(onFieldsChangeInternal) &&
onFieldsChangeInternal(changedFields, allFields)
}

const FormChildren = (
Expand Down Expand Up @@ -372,7 +372,7 @@ const InternalForm: ForwardRefRenderFunction<FormInstance, FormProps> = (
form={formInsatce}
onFinish={onFinish}
onReset={onReset}
onValuesChange={onValuesChange}
onFieldsChange={onFieldsChange}
initialValues={initialStates.initialValues}
{...props}
>
Expand Down

1 comment on commit d1da4ba

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deploy preview for at-console-components ready!

✅ Preview
https://at-console-components-f6lsjerxo.vercel.app

Built with commit d1da4ba.
This pull request is being automatically deployed with vercel-action

Please sign in to comment.