Fix :visible updates being lost for unmapped widgets - #1452
Open
61021 wants to merge 1 commit into
Open
Conversation
Author
|
Bump 🙂 — fixes :visible updates being silently lost for unmapped widgets. Happy to rebase if anything's drifted. |
The initial value of :visible is applied at the widget's first map (to survive the window's show_all), but it was captured at build time. For widgets whose first map happens later — e.g. children of a closed revealer — any reactive :visible update issued in between was clobbered by that stale snapshot when the widget finally mapped: setting visible to true while the revealer was closed left the widget hidden after opening it. Keep the latest value in a shared cell that reactive updates write to, and apply that at first map instead. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
61021
force-pushed
the
fix-visible-latch-unmapped
branch
from
August 6, 2026 07:26
58ceef7 to
a01d7ab
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Fixes #1451.
The initial value of
:visibleis applied at the widget's first map (connect_first_map) so that it survives the window'sshow_all— but the value was captured at build time. For widgets whose first map happens later (children of a closedrevealerbeing the common case), every reactive:visibleupdate issued in between was clobbered by that stale snapshot the moment the widget finally mapped:update vis=truewhile the revealer was closed left the widget hidden after revealing, even thougheww stateshowed the right value.The fix keeps the latest value in a shared
Rc<Cell<bool>>: the reactivevisibleprop writes to it, and the first-map handler reads it instead of a build-time copy. No behavior change for the ordinary cases (initial value application and reactive toggling while mapped work exactly as before — the cell starts with the evaluated initial value).Usage
No configuration changes — existing configs just start behaving as expected:
Showcase
Same sequence (
vis=truewhile closed → reveal), before and after, on master 48f5aa8:vis: truebut widget hidden)The hide-while-closed direction (which already worked, since a hidden widget never maps) is unchanged:
Additional Notes
cargo fmtandcargo clippyclean; CHANGELOG entry added.