Repository navigation
Conversation
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.
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.
Problem
The menu bar UI re-renders on every
onUpdatepush:@Publishedproperties 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):onUpdatefires 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+ fullswift testpass, including new unit tests inStatusPushGateTests(cadence spacing, immediate change-push, anchor reset).