Skip to content

fix app hangs by decoupling menu items from high-churn app state - #3052

Merged
RaajeevChandran merged 1 commit into
mainfrom
seer/fix-app-hangs-menu-state
Oct 9, 2026
Merged

RaajeevChandran merged 1 commit into
mainfrom
seer/fix-app-hangs-menu-state

Conversation

@sentry

@sentry sentry Bot commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

Summary

This change addresses app hangs caused by the osaurusApp observing high-churn singletons like VADService, SpeechModelManager, and ThemeManager. Previously, any @Published change in these objects (e.g., VADService.audioLevel updates, SpeechModelManager download progress) would trigger a re-evaluation of the entire Commands tree and a rebuild of the main menu on the main thread, leading to UI unresponsiveness.

The fix involves refactoring the observation of these singletons to dedicated, localized views, significantly reducing main thread contention and improving overall UI responsiveness, particularly when Voice Detection is active or models are downloading.

Changes

  • Behavior change
  • UI change (screenshots below)
  • Refactor / chore
  • Tests
  • Docs

Specifically:

  • Removing vadService, speechModelManager, and themeManager as @ObservedObjects from the osaurusApp struct.
  • Introducing VADToggleMenuItem as a dedicated View to manage the Voice Detection menu item's state and logic. It now observes only specific, less frequent changes (like voiceConfigurationChanged notifications and SpeechModelManager.shared.selectedModelId changes) and calls VADService.shared directly.
  • Introducing ThemeMenuItems as a dedicated View to encapsulate the Theme submenu and font zoom controls. This view now locally observes ThemeManager.shared.
  • Adding a comment in osaurusApp.swift to guide against reintroducing high-churn @ObservedObject singletons at the App level.

Test Plan

Verify that the app remains responsive, especially when:

  • Voice Detection is active (e.g., speaking into the microphone).
  • Speech models are downloading.
  • Changing themes or font zoom settings.
    Ensure that the Voice Detection menu item and Theme submenu function correctly.

Screenshots

If UI updated, add before/after.

Checklist

  • I have read CONTRIBUTING.md
  • I added/updated tests where reasonable
  • I updated docs/README as needed
  • I verified build on macOS with Xcode 16.4+

Fixes APPLE-MACOS-34A

@sentry <feedback>: Autofix iterates on these changes
@sentry stop iterating: Autofix stops iterating on this run

This PR was automatically generated by Sentry at no cost. You can adjust this setting at any time.

@RaajeevChandran
RaajeevChandran merged commit a7859ba into main Oct 9, 2026
9 checks passed
@RaajeevChandran
RaajeevChandran deleted the seer/fix-app-hangs-menu-state branch October 9, 2026 05:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant