anthonyshort / deku

Render interfaces using pure functions and virtual DOM

Home Page:https://github.com/anthonyshort/deku/tree/master/docs

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Recursion problem

rstacruz opened this issue · comments

I tried making a test case of #343 here. It fails with "too much recursion" (v2.0.0-rc7).

https://jsfiddle.net/wuc48347/

Here's how it should work: https://jsfiddle.net/q7hsuqmp/1/ (using decca@1.0.0)

The problem here is due to the lowercase onclick rather than onClick. The causes are rather obscure but I am gonna investigate.

I think it's because when we see a function as a value for an attribute, we call the function to get the attribute value. This functionality really isn't needed now and should be removed. The idea was that you'd get given the real DOM element when it was called.

I didn't notice the lowercase, that would be the issue. As soon as it sets the attribute, it's calling the rerender. So it'll be an infinite loop.

Yup, this seems to be the case here.

This is fixed in rc10

FYI: I updated onclick to onClick, yet the problem still persists. This is v2.0.0-rc7.
https://jsfiddle.net/rstacruz/wuc48347/1/

Here it is using v2.0.0-rc10, which now works properly.
https://jsfiddle.net/rstacruz/wuc48347/3/