Fix stale panel height when content shrinks#36
Merged
Conversation
The MenuBarExtra window kept its old (too-tall) height after the content shrank — collapsing an environment, clearing the filter, or processes vanishing on refresh left the list vertically centred inside an oversized window. The panel height comes from a GeometryReader in the content's .background, which on macOS 26 only re-measures when its .id() changes (known quirk). That id was tied only to inactiveExpanded, so every other height change went unmeasured and scrollContentHeight stayed stale. Replace the id with contentHeightSignature, a composite hash of every piece of state that affects content height (filter text, all collapse/expand state, per-env process counts and error presence). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
All reported issues were addressed across 2 files
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
contentHeightSignature hashed the raw per-env process count, but when a filter is active the rendered rows come from filteredProcesses(for:) and envNameMatches(_:). A refresh could change which processes match the filter (by name/ports) or whether an env matches (by name/branch) without changing the total count, leaving the signature — and the panel height — stale. Mirror the render logic instead: hash matchesName plus the actual visible process count, which together also capture whether the env is displayed at all. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Owner
Author
|
Good catch — valid. The signature hashed the raw per-env process count, but under an active filter the rendered rows come from Fixed in 6247d4e by mirroring the render logic: the signature now hashes |
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 reeve panel sometimes kept its old, too-tall height after its content got smaller — collapsing an environment, clearing the filter, hitting "Collapse all", or processes vanishing on a refresh would leave the list vertically centred inside an oversized window.
Root cause
The panel's height is driven by
scrollContentHeight, measured by aGeometryReaderin the scroll content's.background. Per the documented macOS 26 MenuBarExtra quirk, that GeometryReader only re-measures when its.id()changes. The id was tied only toinactiveExpanded, so height re-measured on the Inactive toggle but not for any other change that shrinks the content. Combined with theif h > 0guard,scrollContentHeightstayed stuck at its old large value and never came back down.Fix
Replace
.id(inactiveExpanded)with.id(contentHeightSignature)— a composite hash of every piece of state that affects content height:filterText,inactiveExpanded,showInactivecollapsedEnvironmentsandexpandedInactiveEnvironmentsAny change that grows or shrinks the list now recreates the GeometryReader and forces a fresh measurement, so the window resizes to fit.
Also added a Fragility note to the quirk section in
AGENTS.md(whichCLAUDE.mdsymlinks to) so future state dimensions get folded into the signature.Testing
swift buildpasses.🤖 Generated with Claude Code
Summary by cubic
Fixes the panel keeping a too-tall height after content shrinks in the macOS 26 MenuBarExtra. The window now snaps to the correct size immediately, even when filters or refreshes change which rows are visible.
.id(inactiveExpanded)with.id(contentHeightSignature)to force re-measure on any height change.contentHeightSignaturemirrors render logic: hashes filter text, inactive toggle/visibility, collapse/expand state, per-env path/active/error presence, filter match, and the visible process count.AGENTS.mdto keep the signature updated when new height-affecting state is introduced.Written for commit 6247d4e. Summary will update on new commits.