Skip to content

Forwarded binding improvements #290

Open
@ddworak

Description

@ddworak

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions