anthonyshort / deku

Render interfaces using pure functions and virtual DOM
https://github.com/anthonyshort/deku/tree/master/docs
3.41k stars 130 forks source link

Problem on vnode attributes from JSX compile #366

Closed FlorentD closed 8 years ago

FlorentD commented 8 years ago

Hi all, I've played with deku last days and I really enjoy it ! However I've seen something strange with the JSX compile, With a DOM list, the id attribute of vnode created from the node seems to be wrong. It always equals to the size list. This seems to have sad effects on my app. I suspect babel-plugin-transform-react-jsx for having bad behavior but not sure... maybe I'm doing wrong.

Here my repo de reproduce the problem : https://github.com/FlorentD/deku-jsx-problem

Thx !

alt text

anthonyshort commented 8 years ago

Hey! Thanks for finding this. It looks like this is actually a bug with the way we're caching the result thunks (components). In that array of children, the cached rendered <Card />s are all the same. The output in the DOM looks right, but what this will do is lead to incorrect diffing on the next pass and we'll end up replacing nodes that we don't need to.

I've added a test for it now and I'm going to track it down.

anthonyshort commented 8 years ago

Ok I've figured this out. I'll have a fixed push up shortly along with a test. 🤔

anthonyshort commented 8 years ago

This is fixed in rc9. Thanks again :)

FlorentD commented 8 years ago

Thank you !! My app works now like a charm !! :-)