bhauman / devcards

Devcards aims to provide a visual REPL experience for ClojureScript
1.53k stars 116 forks source link

detach-root #140

Open danjohansson opened 6 years ago

danjohansson commented 6 years ago

When using defcard-om with an atom as state. Navigating back and forth between the namespace list and the devcard keeps adding om roots that are not detached when navigating back. I tried this as a workaround

    (will-unmount [_]
                  (println "unmounting this")
                  (let [pn (.-parentNode (om/get-node owner))]
                    (js/setTimeout (fn [] (om/detach-root pn)) 200)))

and it seems to do the trick.

regards Dan

bhauman commented 5 years ago

Yeah I'm trying to fix this for all cases and this solution doesn't seem to work reliably, this is really hard to fix because we are rending a react tree within a react tree. It's limitation with om's current design.