goatslacker / alt

Isomorphic flux implementation
http://alt.js.org/
3.45k stars 322 forks source link

AltContainer shouldComponentUpdate doesn't work as expected "OR" shouldComponentUpdate documents are wrong #489

Closed Rotemy closed 9 years ago

Rotemy commented 9 years ago

Hey,

I'm trying to use AltContainer's shouldComponentUpdate but the document state that This is a function that gets called with the props that your children will receive although I'm getting the props that the children currently have. This is fine for me because I can check if the previous immutable object is different from the next one (I know what is the next object going to be). So if this is just a mistake in the documents please fix it. But if that a bug, when you fix it please add to this function the previous props too so I could make the equality test.

goatslacker commented 9 years ago

we should pass the props from react's shouldcomponentupdate

Rotemy commented 9 years ago

That's find. FYI, if working with immutable data structure I will have to pass the immutable object to the component in order to be able to check the shouldComponenetUpdate properly. I think it's a bad practice to work with immutable objects in components so it would be great to get a workaround for this issue. Thanks.

shaharyakir commented 9 years ago

@goatslacker any news on this?

goatslacker commented 9 years ago

Updated alt-container on npm: https://github.com/altjs/container