Fix high CPU usage from notifications and add regression tests

- Fix auto-updating Text(date, style: .time) causing continuous SwiftUI updates
  by using static formatting with .formatted(date:time:)
- Fix notification popover keeping SwiftUI observers active when closed by
  clearing contentViewController on popover close and recreating on open
- Fix focus loss when notifications arrive while typing by only setting
  focus in NotificationsPage when the page is visible
- Make Update Pill and Update Logs debug-only features
- Add CPU regression tests: test_cpu_usage.py, test_cpu_notifications.py
- Add lint test for auto-updating Text patterns: test_lint_swiftui_patterns.py
This commit is contained in:
Lawrence Chen 2026-01-29 17:02:16 -08:00
parent 5e6aad94c4
commit eb7c06ceb1
7 changed files with 628 additions and 14 deletions

View file

@ -123,6 +123,7 @@ final class WindowToolbarController: NSObject, NSToolbarDelegate {
return item
}
#if DEBUG
if itemIdentifier == updateItemIdentifier, let updateViewModel {
let item = NSToolbarItem(itemIdentifier: itemIdentifier)
let view = NonDraggableHostingView(rootView: UpdatePill(model: updateViewModel))
@ -138,6 +139,7 @@ final class WindowToolbarController: NSObject, NSToolbarDelegate {
}
return item
}
#endif
return nil
}