lihaoyi / workbench-example-app

An example application written in ScalaJS using scala-js-dom and scala-js-workbench
204 stars 109 forks source link

Fixes possible leak of Rx[T] in Framework #29

Closed gabriel-bezerra closed 8 years ago

gabriel-bezerra commented 8 years ago

Authored as suggested by @Voltir on 2016-01-02. Timestamps in UTC-3:

""" Voltir 13:48 @gabriel-bezerra since you are making pull requests, there is another bug you can fix -- change the instances of r() to r.now or else you end up "leaking" rx dependencies into the passed function, which can cause some really unexpected behavior This shows up if you use some rx.Var.map, for instance

Voltir 14:12 Obs already observes the rx variable by virtue of the constructor So you don't need to apply it in the body of the obs

Voltir 14:13 And it leaks in when that thing is implicitly summoned, if there happens to be an rx scope, that outer rx will get a dependency on r """

See: https://gitter.im/scala-js/scala-js?at=5687ff6a3acb611716009970

stewSquared commented 8 years ago

Nice catch! This duplicates work with #37 and is no longer necessary, so I recommend closing.