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

React 16.13.X warning when Field has validator #768

Closed
yann-combarnous opened this issue Apr 1, 2020 · 3 comments · Fixed by final-form/final-form#336
Closed

React 16.13.X warning when Field has validator #768

yann-combarnous opened this issue Apr 1, 2020 · 3 comments · Fixed by final-form/final-form#336

Comments

@yann-combarnous
Copy link

yann-combarnous commented Apr 1, 2020

Are you submitting a bug report or a feature request?

Bug report

What is the current behavior?

https://codesandbox.io/s/react-1613x-final-form-array-yfcmx

Instructions:

  • Click on "Show username" checkbox
  • Watch console error
Warning: Cannot update a component (`ReactFinalForm`) while rendering a different component (`Field`). To locate the bad setState() call inside `Field`, follow the stack trace as described in https://fb.me/setstate-in-render
    in Field (at MyFieldArray.js:12)
    in FieldArray (at MyFieldArray.js:6)
    in MyFieldArray (at App.js:30)
    in form (at App.js:20)
    in ReactFinalForm (at App.js:12)
    in div (at App.js:11)
    in App (at src/index.js:7)

What is the expected behavior?

No console warning

Sandbox Link

What's your environment?

Latest React final form 6.4.0 and latest final form library 4.19, see codesandbox

Other information

@yann-combarnous
Copy link
Author

See offending code at #751 (comment)

@erikras
Copy link
Member

erikras commented Apr 1, 2020

Published fix in final-form@4.19.1.

@zaguiini
Copy link

zaguiini commented Jul 27, 2020

The problem is happening on 4.20.1. Was the fix reverted by any chance?

I'm using the useField hook.

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

Successfully merging a pull request may close this issue.

3 participants