Implement automatic observation tracking for AppKit views#34
Conversation
❌ Build or Tests Failed!Version: 1.2 (1) This PR ran quick tests. Full test suite runs on merge to main. |
02c48fd to
f7ef920
Compare
❌ Build or Tests Failed!Version: 1.2 (1) This PR ran quick tests. Full test suite runs on merge to main. |
❌ Build or Tests Failed!Version: 1.2 (1) This PR ran quick tests. Full test suite runs on merge to main. |
- Add NSObservationTrackingEnabled to Info.plist - Refactor StatusBarObserver to remove manual polling with withObservationTracking - Add ObservableStatusBarButtonView that leverages automatic tracking in draw() and updateConstraints() - Update StatusBarController to integrate automatic observation - Fix compilation errors and warnings This improves performance by eliminating the 50ms polling loop and using AppKit's automatic observation tracking for @observable models. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
- Create ObservableTrackingView base class for common tracking functionality - Replace ObservableStatusBarButtonView with comprehensive ObservableStatusBarDisplayView - Simplify StatusBarController by removing complex update logic - Remove redundant DisplayState and state comparison logic from StatusBarDisplayManager - Add ObservableMenuWindowView for automatic menu window size updates - Add ObservableNetworkStateView as example of network state tracking - Refactor CustomMenuWindow to use automatic tracking for size changes This greatly simplifies the codebase by eliminating manual state comparisons, polling loops, and complex callback chains. The system now automatically tracks Observable property access and updates views when those properties change. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
- Added @State sortOrder property to track column sort state - Updated Table to accept sortOrder binding - Made all table columns sortable by providing value key paths - Created sortedSummaries computed property to apply sorting - Default sort is by date in descending order (newest first) Users can now click on any column header to sort the data accordingly. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
- Show data immediately as files are parsed, not after all complete - Display progress bar at top of table when loading continues - Keep loading indicator visible until all files are processed - Fix loading state logic to allow simultaneous data display and loading - Improve user experience by showing partial results during scan The report now displays entries as soon as they're parsed while showing progress in the header, allowing users to see data immediately instead of waiting for all 275+ files to complete processing. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
- Fix trailing spaces and line breaks - Apply consistent indentation - Remove unused arguments - Fix redundant optional binding
3fb34ba to
a8f7434
Compare
❌ Build or Tests Failed!Version: 1.2 (1) This PR ran quick tests. Full test suite runs on merge to main. |
🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
❌ Build or Tests Failed!Version: 1.2 (1) This PR ran quick tests. Full test suite runs on merge to main. |
The timer-based approach in NetworkStateManager is more appropriate for checking stale data periodically since: - Staleness is time-based (data becomes stale by time passing) - No UI dependency required for service-level monitoring - Timer is already implemented and activated in MultiProviderDataOrchestrator 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
❌ Build or Tests Failed!Version: 1.2 (1) This PR ran quick tests. Full test suite runs on merge to main. |
Summary
This PR implements automatic observation tracking throughout VibeMeter, leveraging macOS 15's
NSObservationTrackingEnabledfeature to eliminate manual polling and state comparison logic.Changes
Core Infrastructure
NSObservationTrackingEnabledto Info.plist to enable the featureObservableTrackingViewbase class that provides common tracking functionalitytrackObservableProperties()to specify which Observable properties to trackStatusBar Refactoring
withObservationTrackingDisplayStatestruct and all state comparison logicObservableStatusBarDisplayViewthat automatically updates when Observable properties changeMenu Window Enhancements
ObservableMenuWindowViewfor automatic size trackingCustomMenuWindownow automatically resizes when user sessions or provider data changesAdditional Components
ObservableNetworkStateViewas an example of network state tracking (though timer-based approach is still appropriate for stale data checking)Benefits
Technical Details
With
NSObservationTrackingEnabled, AppKit automatically tracks Observable property access in specific methods:viewWillDraw()updateConstraints()layout()draw(_:)When tracked properties change, these methods are automatically called again, eliminating the need for manual observation.
Testing
🤖 Generated with Claude Code