cycle-snabbdom
cycle-snabbdom copied to clipboard
Root element is replaced
It seems that root (container) element is being replaced while DOM update. I belive driver should leave it alone (as @cycle/dom does)
I perform a check to avoid this here which is roughly the equivalent to what @cycle/dom does here
Do you spot an area where I'm doing an improper check?
Well this code performs check if container changed
import Cycle from '@cycle/core'
import {h, div, makeDOMDriver} from 'cycle-snabbdom'
import Rx from 'rx'
var main = function(sources){
return {
DOM: Rx.Observable.just(1).map(x => div('x=' + x))
}
}
var container = document.getElementById('app')
setTimeout(() => {
console.log('check', container == document.getElementById('app')) // check false
})
Cycle.run(main, {
DOM: makeDOMDriver(container)
})
It shows that container "has changed".
Hm, hm got the same result for cycle/dom in this test
Just tried this http://esnextb.in/?gist=cc30f6b0513a4c2f74ee
It's saying they are the same for me
The problem is actuatual for sync version of cycle/core without setTimeout (for both dom drivers)
https://github.com/cyclejs/core/issues/200
@staltz