Closed juliangruber closed 7 years ago
next i want to add reordering
ok, this triggers a bug now: when you move down the first element, the placeholder element will be rendered
this is a comparison of the dom: https://gist.github.com/juliangruber/9f76bea837968fd4d27560eeaf56c067
It's a bit tricky to explain what was going on here, but I'll try my best:
Before, we were overwriting this._render
in this module. Nanocomponent calls to this._render()
and then afterwards applies the this._ID
logic. That means however, that the new tree that is being morphed in this module, doesn't have the ID
yet! => nanomorph thinks it's different nodes
I therefore changed it to be the other way around. In this module, we set this._render
to the handler function passed to .on('render', handler)
, and then override this.render
with our morphing logic. So before it was nanocomponent calling microcomponent's render function, now it's microcomponent calling nanocomponent's render function. Which is the right way around.
The example now works 100% for me, as long as you update your local nanocomponent to this PR: https://github.com/yoshuawuyts/nanocomponent/pull/33
3.1.4
so far everything works fine!