Skip to content

fix(popover): avoid SwiftUI ProgressView constraint assertion#19

Open
jeanfw wants to merge 1 commit into
eddmann:mainfrom
jeanfw:fix/popover-progressview
Open

fix(popover): avoid SwiftUI ProgressView constraint assertion#19
jeanfw wants to merge 1 commit into
eddmann:mainfrom
jeanfw:fix/popover-progressview

Conversation

@jeanfw
Copy link
Copy Markdown

@jeanfw jeanfw commented May 10, 2026

Summary

The refresh button in the usage popover composes ProgressView().scaleEffect(0.7).frame(width: 20, height: 20). On macOS this triggers a SwiftUI runtime assertion when the button enters the refreshing state:

<_TtGC7SwiftUI22AppKitPlatformViewHostGVS_P10$1bc60db8432PlatformViewRepresentableAdaptorVS_18AppKitProgressView__: 0xace0a8a80>
has an maximum length (32.142857) that doesn't satisfy min (32.142857) <= max (32.142857).

The min and max are identical values (≈ 225/7), but SwiftUI's strict floating-point comparison still rejects them. The cause: AppKit's NSProgressIndicator returns an intrinsic content size that's a non-terminating decimal, and feeding it back through scaleEffect + frame produces values that fail bitwise equality.

The fix

Replace the scaleEffect(0.7) + frame(20, 20) combo with controlSize(.small). This is the macOS-native way to ask for a smaller spinner and skips the conflicting size constraints — same visual reduction, no runtime assertion, fewer modifiers.

Test plan

  • Click the refresh button in the usage popover; the small spinner appears with no console warnings.
  • The spinner is visually similar to the previous 14×14 rendering (small control size).
  • No regression in the surrounding arrow.clockwise icon when the popover is idle.

🤖 Generated with Claude Code

Combining .scaleEffect(0.7) and .frame(width:20, height:20) on the
refresh button's circular ProgressView triggers a SwiftUI runtime
assertion on macOS ("maximum length doesn't satisfy min <= max" with
identical operands), caused by AppKit's NSProgressIndicator returning
an intrinsic size that fails strict floating-point comparison against
the framed bounds. Switching to .controlSize(.small) gives the same
visual reduction without conflicting size constraints.
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