Skip to content

Commit 8b63fed

Browse files
committed
fix: restore welcome window when suppression times out after 15s
1 parent fea651f commit 8b63fed

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

TablePro/AppDelegate+WindowConfig.swift

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,14 +195,21 @@ extension AppDelegate {
195195
// Keep trying to close the welcome window until a main window is visible.
196196
// DuckDB and other slow-connecting databases may take several seconds,
197197
// so we poll repeatedly rather than giving up after 700ms.
198+
var suppressed = false
198199
for attempt in 0 ..< 30 {
199200
try? await Task.sleep(for: .milliseconds(attempt < 4 ? 200 : 500))
200201
guard let self else { return }
201202
if self.closeWelcomeWindowIfMainExists() {
203+
suppressed = true
202204
break
203205
}
204206
}
205207
guard let self else { return }
208+
if !suppressed {
209+
// Timed out — restore welcome window so the app isn't left windowless
210+
windowLogger.warning("Welcome window suppression timed out after 15s, restoring welcome window")
211+
self.openWelcomeWindow()
212+
}
206213
self.fileOpenSuppressionCount = max(0, self.fileOpenSuppressionCount - 1)
207214
if self.fileOpenSuppressionCount == 0 {
208215
self.isHandlingFileOpen = false

0 commit comments

Comments
 (0)