Skip to content

Fix :visible updates being lost for unmapped widgets - #1452

Open
61021 wants to merge 1 commit into
elkowar:masterfrom
61021:fix-visible-latch-unmapped
Open

Fix :visible updates being lost for unmapped widgets#1452
61021 wants to merge 1 commit into
elkowar:masterfrom
61021:fix-visible-latch-unmapped

Conversation

@61021

@61021 61021 commented Jul 25, 2026

Copy link
Copy Markdown

Description

Fixes #1451.

The initial value of :visible is applied at the widget's first map (connect_first_map) so that it survives the window's show_all — but the value was captured at build time. For widgets whose first map happens later (children of a closed revealer being the common case), every reactive :visible update issued in between was clobbered by that stale snapshot the moment the widget finally mapped: update vis=true while the revealer was closed left the widget hidden after revealing, even though eww state showed the right value.

The fix keeps the latest value in a shared Rc<Cell<bool>>: the reactive visible prop 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:

(defvar reveal false)
(defvar vis false)

(revealer :reveal reveal
  (label :visible vis :text "hello"))
$ eww update vis=true     ; while the revealer is closed
$ eww update reveal=true  ; label now correctly appears

Showcase

Same sequence (vis=true while closed → reveal), before and after, on master 48f5aa8:

before (bug: vis: true but widget hidden) after
before after

The hide-while-closed direction (which already worked, since a hidden widget never maps) is unchanged:

hide direction

Additional Notes

  • Verified on a live Wayland/Hyprland session (both directions, plus toggling while revealed).
  • cargo fmt and cargo clippy clean; CHANGELOG entry added.

@61021

61021 commented Jul 31, 2026

Copy link
Copy Markdown
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
61021 force-pushed the fix-visible-latch-unmapped branch from 58ceef7 to a01d7ab Compare August 6, 2026 07:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

:visible updates are lost for widgets inside a closed revealer (stale value applied at first map)

1 participant