gcanti / tcomb-form

Forms library for react
https://gcanti.github.io/tcomb-form
MIT License
1.16k stars 136 forks source link

`Component` doesn't updates on path change #388

Closed gbiryukov closed 7 years ago

gbiryukov commented 7 years ago

Version

Expected behaviour

Components gets re-rendered when its path changes.

Actual behaviour

tcomb Component class has shouldComponentUpdate defined that prevent component update on path changes

Steps to reproduce

  1. go to demo (source)
  2. add two elements
  3. remove first one

You will see that remaining element will have path 1.title but it's actual path 0.title. If you will try to type something into this textbox it will pass incorrect path to form onChange callback

It quite easy to fix in t.form.Component shouldComponentUpdate method

gcanti commented 7 years ago

@gbiryukov thanks for the detailed bug report, would you like to send a PR?

gbiryukov commented 7 years ago

sure, np