Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Root element is replaced #22

Open
wclr opened this issue Mar 7, 2016 · 5 comments
Open

Root element is replaced #22

wclr opened this issue Mar 7, 2016 · 5 comments

Comments

@wclr
Copy link

wclr commented Mar 7, 2016

It seems that root (container) element is being replaced while DOM update. I belive driver should leave it alone (as @cycle/dom does)

@TylorS
Copy link
Owner

TylorS commented Mar 8, 2016

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?

@wclr
Copy link
Author

wclr commented Mar 8, 2016

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

@TylorS
Copy link
Owner

TylorS commented Mar 8, 2016

Just tried this
http://esnextb.in/?gist=cc30f6b0513a4c2f74ee

@TylorS
Copy link
Owner

TylorS commented Mar 8, 2016

It's saying they are the same for me

@wclr
Copy link
Author

wclr commented Mar 8, 2016

The problem is actuatual for sync version of cycle/core without setTimeout (for both dom drivers)
cyclejs/cyclejs#200
@staltz

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants