You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Reactive attributes in brr-lwd have a strange semantic. See for instance this example (also available here)
let ui =let v =Lwd.var trueinlet click=Elwd.handler Ev.click (fun_ -> Lwd.update (not) v) inlet button =Elwd.button ~ev:[`P click] [`P(El.txt' "Salut")] inlet at1 =let$ b =Lwd.get v inif b thenAt.name (Jstr.v "name1")
elseAt.title (Jstr.v "title1")
inlet at2 =let$ b =Lwd.get v inifnot b thenAt.name (Jstr.v "name2")
elseAt.title (Jstr.v "title2")
inlet el =Elwd.div ~at:[`R at1; `R at2] [
`P (El.txt' "Try clicking the button and see how the attributes change.");
]
inElwd.div [ `R el; `R button ]
Basically at1 and at2 are two reactive attributes, depending on a reactive boolean. They set name or title depending on the boolean, but never the same (if b is true, at1 sets name and at2 sets title, if b is false, at1 sets title and at2 sets name)
This results in attributes being canceled when updating the boolean:
Peek.2026-02-14.16-52.webm
(expected behavior is to have (name=name1 AND title=title2) OR (name=name2 AND title=title1), not half of that)
It is tricky to fix. We could have the key not be reactive, but we probably have the same problem with sequences? We could have "absent" values not be unset, but have values as options (and None means unsetting). Those options are all breaking.
And I'm opening this as I'm working on reactive styles/properties. Especially in the prop values, unsetting when a prop is not present anymore is questionable.
Reactive attributes in brr-lwd have a strange semantic. See for instance this example (also available here)
Basically
at1andat2are two reactive attributes, depending on a reactive boolean. They setnameortitledepending on the boolean, but never the same (if b is true,at1setsnameandat2setstitle, if b is false,at1setstitleandat2setsname)This results in attributes being canceled when updating the boolean:
Peek.2026-02-14.16-52.webm
(expected behavior is to have (
name=name1ANDtitle=title2) OR (name=name2ANDtitle=title1), not half of that)It is tricky to fix. We could have the key not be reactive, but we probably have the same problem with sequences? We could have "absent" values not be unset, but have values as options (and
Nonemeans unsetting). Those options are all breaking.And I'm opening this as I'm working on reactive styles/properties. Especially in the prop values, unsetting when a prop is not present anymore is questionable.