Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Form - onFieldsChange is fired three times instead of 1 #23798

Closed
1 task done
avalanche1 opened this issue Apr 30, 2020 · 7 comments · Fixed by #23808
Closed
1 task done

Form - onFieldsChange is fired three times instead of 1 #23798

avalanche1 opened this issue Apr 30, 2020 · 7 comments · Fixed by #23808
Assignees

Comments

@avalanche1
Copy link

avalanche1 commented Apr 30, 2020

  • I have searched the issues of this repository and believe that this is not a duplicate.

Reproduction link

Edit on CodeSandbox

Steps to reproduce

type one letter in repro input

What is expected?

123 logged to console once

What is actually happening?

123 logged to console thrice

Environment Info
antd 4.2.0
React latest
System any
Browser chrome 81
@yoyo837
Copy link
Contributor

yoyo837 commented Apr 30, 2020

Did you forget to save codesandbox?

@avalanche1
Copy link
Author

Yep. Fixed, thx.

@yoyo837
Copy link
Contributor

yoyo837 commented Apr 30, 2020

onFieldsChange fired by field change like value or error and any other. Maybe onValuesChange is what you want.

@avalanche1
Copy link
Author

Do you mean typing a char is causing three props to change?

@asumaran
Copy link

asumaran commented May 1, 2020

Probably related to my issue #23803 @avalanche1 are you using React.StrictMode by any chance?

@zombieJ
Copy link
Member

zombieJ commented May 1, 2020

It's by design: #23060 (comment)

Let me add this in FAQ since asked many times.

@afc163
Copy link
Member

afc163 commented May 1, 2020

Try onValuesChange

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants