Skip to content

app: push UI state at a 1s cadence and immediately on visible change - #75

Open
iBobbyTS wants to merge 1 commit into
ProducerGuy:mainfrom
iBobbyTS:fix/status-push-cadence
Open

iBobbyTS wants to merge 1 commit into
ProducerGuy:mainfrom
iBobbyTS:fix/status-push-cadence

Conversation

@iBobbyTS

Copy link
Copy Markdown

Problem

The menu bar UI re-renders on every onUpdate push: @Published properties change and the SwiftUI MenuBarExtra rebuilds its view graph and the NSStatusItem replicant snapshot. At the current 500ms cadence the menu's contents are mid-rebuild a meaningful fraction of the time it is open, which can eat a picker tap — observed failure mode: a profile-switch click vanishing with no log line and no effect, the view identity having changed under the click.

Fix

New StatusPushGate (pure decision logic): onUpdate fires at most every 1s (10 × 100ms ticks) instead of 500ms, and a visible change (profile switch, monitor-state transition) still pushes immediately, so the UI never lags a user action by a full interval. The immediate push also re-anchors the cadence.

Testing

swift build + full swift test pass, including new unit tests in StatusPushGateTests (cadence spacing, immediate change-push, anchor reset).

The menu bar UI re-renders on every onUpdate push: @published properties
change and the SwiftUI MenuBarExtra rebuilds its view graph and the
NSStatusItem replicant snapshot. At the old 500ms cadence the menu's
contents were mid-rebuild a meaningful fraction of the time it was open,
which can eat a picker tap — an observed failure mode: a profile-switch
click vanishing with no log line and no effect, the view identity having
changed under the click.

New StatusPushGate (pure decision logic): onUpdate fires at most every
1s (10 × 100ms ticks) instead of 500ms, and a visible change (profile
switch, monitor-state transition) still pushes immediately, so the UI
never lags a user action. Unit tests cover cadence, the immediate
change-push, and the cadence anchor reset.
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.

1 participant