gcanti/tcomb-form

`Component` doesn't updates on path change

Closed this issue · 2 comments

Version

  • tcomb-form v0.9.16
  • react v0.15.4

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

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

sure, np