gowade / wade

Web development with isomorphic Go
BSD 2-Clause "Simplified" License
164 stars 11 forks source link

problem with data-each #3

Closed cryptix closed 10 years ago

cryptix commented 10 years ago

Hi,

i started hacking on a TodoMVC example. It's still very much WIP but you can find it on my fork of wade here. I basically just introduced a custom element for the entries until know which you can than toggle or double click to edit.

I than wanted to add some kind of store to do the toggleAll, filtering, destoying etc. So I created a Controller returning a TodoView which has an Entries []TodoEntry field. I than tried to data-each that field in my html but I only get the error Uncaught RangeError: Maximum call stack size exceeded.. Maybe I'm doing something inappropriate there, I don't know.. I pushed a separate branch here with my code at this point.

I'm also open for other suggestions but I don't think there is much else to comment on yet.

hami9x commented 10 years ago

Look like a bug, I'll investigate the issue.

hami9x commented 10 years ago

Gopherjs creates some kind of mysterious infinitely looping structure for slices ($val->$val->$val->$val...). Look like I have to modify watch.js again to avoid the issue.

hami9x commented 10 years ago

I updated our bower watch.js repo. A bower update now would solve the infinite loop. But your code doesn't work yet, there are 2 flaws, one I just fixed with the new commit, and one is the flaw that: custom elements' model are created before binding, as a result when multiple custom elements are created with bind-each, only one model is used and so all elements have the same value. I'm working on it.

cryptix commented 10 years ago

okay, good to know that I got the general idea. :)

Kind of related note: it would be awesome if data-each would work on custom elements. (maybe it does, didn't test actually) it would get rid of the surrounding <div> in a lot of cases.

cryptix commented 10 years ago

Just tested it, works like you described, thanks.

hami9x commented 10 years ago

All issues fixed now, cheers :). Thanks for the involvement dude. Btw I updated your code a bit, PRed on your repo.