final-form / react-final-form

🏁 High performance subscription-based form state management for React
https://final-form.org/react
MIT License
7.39k stars 481 forks source link

Initial value of object in Field component causes an infinite loop #886

Open avevlad opened 3 years ago

avevlad commented 3 years ago

Reproduce code:

<Field
  initialValue={{ foo: "bar" }}
  name="firstName"
>

Sandbox Link

with bug: https://eplfx.csb.app/ without bug: https://03u06.csb.app/

Env

final-form: latest (4.20.1) react: latest (17.0.1) react-dom: latest (17.0.1) react-final-form: latest (6.5.2) styled-components: latest (5.2.1)

https://user-images.githubusercontent.com/2889662/104350545-509be400-5515-11eb-81da-fb3009459c14.mp4

https://user-images.githubusercontent.com/2889662/104350907-c011d380-5515-11eb-88e9-760e52dbfccc.mp4

bwindsor commented 3 years ago

Duplicate of #686 See https://github.com/final-form/react-final-form/issues/686#issuecomment-919111329