gcanti / tcomb-form

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

Kind is undefined in onChange for nested List #231

Closed leoasis closed 8 years ago

leoasis commented 8 years ago

I have a model that is a t.struct that contains a property of t.list of t.struct which in turn contains a property that is a t.list. So basically a list inside a struct inside a list inside a struct :P

Whenever I add or remove an item in the nested list, the onChange callback for the form returns with a kind of undefined, which is incorrect and should be add or remove respectively. This works fine with top level lists, but it fails when the list is inside a struct inside another list. I've tracked this to the onItemChange function in the List component, which doesn't take into account if the change is from a nested list, and completely discards the kind.

gcanti commented 8 years ago

Hi @leoasis, good catch! Thanks. Just pushed a fix to master and 0.6.x branches.

leoasis commented 8 years ago

@gcanti thanks! I'm really impressed by the speed in which you address all the issues! Thanks a lot again and awesome job

gcanti commented 8 years ago

Well, you helped me a lot with your detailed description, thanks again.

benmonro commented 8 years ago

@gcanti for president!