Skip to content

fix(pill): stop capturing UserDefaults in the look observer - #476

Merged
scttbnsn merged 1 commit into
dev/v0.7.0from
fix/glass-pill-sendable
Oct 26, 2026
Merged

scttbnsn merged 1 commit into
dev/v0.7.0from
fix/glass-pill-sendable

Conversation

@scttbnsn

Copy link
Copy Markdown
Contributor

The look observer in GlassBackdropCache.startObserving captured the defaults and a local lastLook var in a @sendable notification closure. That produced three SendableClosureCaptures warnings (capture of UserDefaults at 315:62, reference to lastLook at 316:27, mutation of lastLook at 317:13) that a warnings-as-errors build only passed because they were not promoted.

lastLook is now an instance property, and the closure only calls a new main-actor defaultsDidChange() through a weak self, which reads the settings the cache already stores. Behavior is the same: an unrelated defaults write does nothing, a skin or size change prewarms once. Added tests for the unrelated-write, changed-look and start-of-observing cases.

Verified: swift build -Xswiftc -warnings-as-errors prints 0 Sources warnings (only the known mlx-swift_Cmlx.bundle missing-creator build-system warning remains), swift-format lint --strict is clean on both files, and scripts/swift-test.sh --no-parallel --filter 'GlassPill|PillFollowUp' passes 38 tests in 9 suites.

The look observer in GlassBackdropCache.startObserving captured defaults and a
local lastLook var in a @sendable closure, giving three SendableClosureCaptures
warnings (315:62, 316:27, 317:13). lastLook is now an instance property and the
closure calls a main-actor defaultsDidChange() through a weak self.
Adds tests for unrelated writes, changed looks and the initial look.
@coderabbitai

coderabbitai Bot commented Oct 26, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 26c677a9-3fa0-413d-bc77-43443caf5353

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@scttbnsn
scttbnsn merged commit d1b7cbe into dev/v0.7.0 Oct 26, 2026
16 checks passed
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