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
TL;DR: We should not prevent a message from being posted just because the state of the widget was changed programmatically, and even though the programmer already knows the state changed.
Immediate effect: TabbedContent will now post TabActivated when the reactive attribute active is assigned to.
Possible further considerations:
Add a message Completed to the ProgressBar widget.
Add a message Started to the ProgressBar widget.
...?
Thesis:
Most widgets will post appropriate messages when their state changes, even if through programmatic means.
E.g.,
DataTable will post CellHighlighted if we move the cursor with .move_cursor or by assigning directly to cursor_coordinate;
Checkbox and RadioButton will post Changed if we toggle them with .toggle or by assigning directly to value; and
OptionList will post OptionHighlighted if we assign to the reactive highlighted.
I think all programmatic changes should still post the appropriate messages that reflect the changes that happened.
Even if a programmer does changes like this programmatically, they are sensible in assuming that the respective events will be triggered.
This lets them decouple two things:
the logic that will change some state; and
the logic that handles changes to the state.
If a programmer does not want the message, they can explicitly opt-out with the context manager prevents, which is why the context manager was created in the first place.
TL;DR: We should not prevent a message from being posted just because the state of the widget was changed programmatically, and even though the programmer already knows the state changed.
Immediate effect:
TabbedContent
will now postTabActivated
when the reactive attributeactive
is assigned to.Possible further considerations:
Completed
to theProgressBar
widget.Started
to theProgressBar
widget.Thesis:
Most widgets will post appropriate messages when their state changes, even if through programmatic means.
E.g.,
DataTable
will postCellHighlighted
if we move the cursor with.move_cursor
or by assigning directly tocursor_coordinate
;Checkbox
andRadioButton
will postChanged
if we toggle them with.toggle
or by assigning directly tovalue
; andOptionList
will postOptionHighlighted
if we assign to the reactivehighlighted
.I think all programmatic changes should still post the appropriate messages that reflect the changes that happened.
Even if a programmer does changes like this programmatically, they are sensible in assuming that the respective events will be triggered.
This lets them decouple two things:
If a programmer does not want the message, they can explicitly opt-out with the context manager
prevents
, which is why the context manager was created in the first place.To consider if this is accepted.
TabbedContent
: the usage ofprevent
in theTabbedContent
comes from Prevent reactive-watcher loop in Tabs / TabbedContent. #2305 and Revert "Prevent reactive-watcher loop in Tabs / TabbedContent." #2322, so take those two PRs into account when fixing this.The text was updated successfully, but these errors were encountered: