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

Forwarded binding improvements #290

Open
ddworak opened this issue May 17, 2019 · 0 comments
Open

Forwarded binding improvements #290

ddworak opened this issue May 17, 2019 · 0 comments
Milestone

Comments

@ddworak
Copy link
Member

ddworak commented May 17, 2019

Follow-up from #282

val p = Property(2)
val s = Property(3)

div(
  produceWithNested(p.transform(_ + 1)) { case (v, nested) =>
    div(
      nested(produce(s) { v2 =>
        println((v, v2))
        div().render
      })
    ).render
  }
).render

CallbackSequencer().sequence {
  p.set(20)
  s.set(30)
}

CallbackSequencer().sequence {
  s.set(300)
  p.set(200)
}

prints:

(3,3)
(3,30) // ???
(21,30)
(21,300) // ???
(201,300)

In the example, the (21,300) case is not avoidable, but the (3, 30) should be (as we've seen in previous changes). The callbacks are sequenced correctly there according to our current logic - the listeners are on a derived/forwarded property, therefore its callbacks are queued and executed at the end.
We can consider pinning callbacks for derived properties to origin, but I'm not sure it's possible in all cases yet.

@ddworak ddworak added this to the 1.0 milestone May 17, 2019
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

1 participant