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

Re-render appends result to DOM (v2.0.0-rc5) #324

Closed sukazavr closed 8 years ago

sukazavr commented 8 years ago

After re-render render method appends new tree in to the existent DOM.

Before and after example:

Before
<div id="app">
  <b>my-component</b>
</div>

After re-render
<div id="app">
  <b>my-component</b><b>my-component</b>
</div>

Also render method on first call doesn't replace inner content in the entry element.

Before and after example:

Before
<div id="app">
  Hello!
</div>

After render
<div id="app">
  Hello!
  <b>my-component</b>
</div>
anthonyshort commented 8 years ago

Any chance you could provide a code sample for the first issue? There are a lot of tests that render multiple times so that shouldn't be the problem.

Is it just that it's not replacing the existing content on the first render?

sukazavr commented 8 years ago

Oh... I created a simplified test stand and then i saw disappearance of the problem :-) Now, I don't understand what happened. Let me look around. I'll write.

rstacruz commented 8 years ago

I think I know. This can happen when there's a JS error that stops deku from finishing up the DOM update process... you might have missed it in your logs. deku will append a new node and remove the old one, but if the process was halted you'll see two of the same node.

rstacruz commented 8 years ago

oops... I just encountered this, and without errors, too. I can't quite make a reduced test case right now, though.

sukazavr commented 8 years ago

I did not understand what happened, but in the v2.0.0-rc6 version the behaviour is not repeated :-)