From 4b1e02c7c3cf6d6a3548a67d88d08d4962ff67ed Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Sun, 9 Aug 2026 16:51:07 -0700 Subject: [PATCH] macos: do not load the config errors window when there are no errors Measured on macOS (Apple Silicon) during app launch, via a startup timeline instrumented across the Swift app and libghostty: config apply, errors step: 35.5ms -> 0.1ms main() -> first frame rendered: ~126ms -> ~93ms main() -> window visible: ~193ms -> ~173ms --- .../Settings/ConfigurationErrorsController.swift | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/macos/Sources/Features/Settings/ConfigurationErrorsController.swift b/macos/Sources/Features/Settings/ConfigurationErrorsController.swift index 9956f7873..1dca58a1c 100644 --- a/macos/Sources/Features/Settings/ConfigurationErrorsController.swift +++ b/macos/Sources/Features/Settings/ConfigurationErrorsController.swift @@ -13,7 +13,15 @@ class ConfigurationErrorsController: NSWindowController, NSWindowDelegate, Confi @Published var errors: [String] = [] { didSet { if errors.count == 0 { - self.window?.performClose(nil) + // Only close the window if it was ever loaded: accessing + // `window` on an NSWindowController loads the nib (and our + // SwiftUI content view), which takes tens of milliseconds. + // This happens on every app launch via the initial config + // apply, when there are usually no errors and the window + // was never loaded. + if isWindowLoaded { + self.window?.performClose(nil) + } } } }