Mithril.js: Investigate duplicated DOM tree issue in routed mount point

Created on 6 Apr 2017  路  12Comments  路  Source: MithrilJS/mithril.js

@modmanx reported a problem where he ends up with a duplicated DOM tree when switching routes:

https://gitter.im/lhorie/mithril.js?at=58e4abacad849bcf425273df

hi, I updated to version 1.1.1 and when I change routes from route2 to route1 and back to route2 main layout is in DOM twice
image

{
   "/": {
       render: function() {
           return m(PageChooseEvent)
       },
   },
   "/:id_event/brackets": {
       render: function() {
         appstate.active_page = 'brackets'
           return m(Layout, m(PageBrackets))
       },
   }
}

m("div.page--event", ...) is what Layout component returns

@modmanx it would be nice if you could provide a JSBin repro. Also, what version were you upgrading from?

Needs reproduction Bug

Most helpful comment

So is this close-worthy?

All 12 comments

Hi,
I'll try to make JSBin repro now. I believe it has something to do because I'm using iframe with youtube embed and enablejsapi parameter set to one.

@modmanx thanks for the follow up :-)

Hello again. I found out what do I need to do to fix this but not sure where exactly is the problem. I can not reproduce on jsbin or locally. I will try to copy project and remove as much code to reproduce bug.

Anyhow - All I did was to include app.js code (generated code with webpack) to be last script to be included in body.

:+1:

What version were you upgrading from?

Now I'm rethinking and I believe we did not had this code exactly in a state that would cause bug like it's happening now, so I don't think that's bug related. It was 1.0.1 before. I will copy code and set mithril to this version and check if bug is there. Gimme a minute.

I checked and tested with version 1.0.1 and div gets rendered twice if

Related issues

barneycarroll picture barneycarroll  路  3Comments

hadihammurabi picture hadihammurabi  路  4Comments

simov picture simov  路  4Comments

marciomunhoz picture marciomunhoz  路  4Comments

designMoreWeb picture designMoreWeb  路  4Comments