[I don't have a standalone reproducer, but I think it's straightforward enough]
I have a view that looks like this:
public export
display : St -> Cmd Ev
display s = batch
[ attr playBtn $ onClick $ Play (not s.playing)
, child playBtn $ span [ classes ["bi", if s.playing then "bi-pause-fill" else "bi-play-fill"] ] []
]
So this changes the onClick event of the playBtn every time the UI is updated. However, it seems that attr playBtn $ onClick e doesn't replaceplayBtn's onClick callback; rather, it extends it so now clicking the button yields two events. Then after the next update, it will yield three events and so on. And gods help you if this display ends up running in response to that Play event...
Note that the documentation explicitly mentions attr as valid for changing callbacks:
attr: Sets a single attribute at a node. This could also be a new
event.
Yes, this is indeed currently not possible. For the time being it would be best do update the documentation, because I currently don't see an easy way for enabling this.
[I don't have a standalone reproducer, but I think it's straightforward enough]
I have a view that looks like this:
So this changes the
onClick
event of theplayBtn
every time the UI is updated. However, it seems thatattr playBtn $ onClick e
doesn't replaceplayBtn
'sonClick
callback; rather, it extends it so now clicking the button yields two events. Then after the next update, it will yield three events and so on. And gods help you if thisdisplay
ends up running in response to thatPlay
event...Note that the documentation explicitly mentions
attr
as valid for changing callbacks: