Skip to content

Commit 121deb4

Browse files
committed
fix: handle pending table ops and file dirty in saveAndClose flow
1 parent 8aeba44 commit 121deb4

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

TablePro/Views/Main/MainContentCommandActions.swift

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -358,9 +358,11 @@ final class MainContentCommandActions {
358358
return
359359
}
360360

361-
// Data grid changes take priority (synced to sidebar editState,
362-
// and the data grid path uses the correct plugin driver for SQL generation)
363-
if coordinator.changeManager.hasChanges {
361+
// Data grid changes or pending table operations take priority
362+
let hasDataChanges = coordinator.changeManager.hasChanges
363+
|| !pendingTruncates.wrappedValue.isEmpty
364+
|| !pendingDeletes.wrappedValue.isEmpty
365+
if hasDataChanges {
364366
let saved = await withCheckedContinuation { continuation in
365367
coordinator.saveCompletionContinuation = continuation
366368
saveChanges()
@@ -378,6 +380,13 @@ final class MainContentCommandActions {
378380
return
379381
}
380382

383+
// File save (query editor with source file)
384+
if coordinator.tabManager.selectedTab?.isFileDirty == true {
385+
saveFileToSourceURL()
386+
performClose()
387+
return
388+
}
389+
381390
performClose()
382391
}
383392

0 commit comments

Comments
 (0)