Skip to content

Commit 517ea9d

Browse files
authored
Merge branch 'main' into fix/datagrid-disabled-chevron-on-deleted-row
Signed-off-by: Ngô Quốc Đạt <datlechin@gmail.com>
2 parents 410f897 + 3ad6521 commit 517ea9d

6 files changed

Lines changed: 5 additions & 31 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
3636
### Fixed
3737

3838
- Result-grid cells on rows marked for deletion keep their dropdown / date / JSON / blob chevron visible at reduced opacity instead of hiding it, so the cell type is still legible while clearly inactive. Click on the dimmed chevron is a no-op; FK arrow navigation is unchanged. Matches the macOS HIG "disabled appearance" guideline.
39+
- Foreign key navigation from a table with unsaved edits opens the referenced table in a new window tab to preserve the edit buffer. Closing that new tab no longer wipes the original tab's data grid. Previously the new tab's teardown broadcast a connection-scoped event that other coordinators on the same connection received, causing them to release their cell data.
3940
- Tables sidebar refreshes automatically after a successful SQL import; the refresh notification now fires after the success sheet's dismissal animation, so the main window is key when the observer runs (#1114)
4041
- PostgreSQL connections honor the import dialog's "Disable foreign key checks" option via `SET session_replication_role = replica` (requires REPLICATION role or superuser; managed Postgres typically rejects it) (#1114)
4142
- PostgreSQL SQL exports preserve GENERATED ALWAYS AS IDENTITY values on round-trip (using OVERRIDING SYSTEM VALUE) and skip GENERATED ... STORED columns (#1114)

TablePro/Core/Events/AppEvents.swift

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ final class AppEvents {
3434

3535
let databaseDidConnect = PassthroughSubject<DatabaseDidConnect, Never>()
3636

37-
let mainCoordinatorTeardown = PassthroughSubject<MainCoordinatorTeardown, Never>()
3837

3938
// MARK: - Window
4039

@@ -76,6 +75,3 @@ struct DatabaseDidConnect: Sendable {
7675
let connectionId: UUID
7776
}
7877

79-
struct MainCoordinatorTeardown: Sendable {
80-
let connectionId: UUID
81-
}

TablePro/Views/Main/MainContentCoordinator.swift

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -562,9 +562,7 @@ final class MainContentCoordinator {
562562
for task in activeSortTasks.values { task.cancel() }
563563
activeSortTasks.removeAll()
564564

565-
AppEvents.shared.mainCoordinatorTeardown.send(
566-
MainCoordinatorTeardown(connectionId: connection.id)
567-
)
565+
dataTabDelegate?.tableViewCoordinator?.releaseData()
568566

569567
tabSessionRegistry.removeAll()
570568
querySortCache.removeAll()

TablePro/Views/Results/DataGridCoordinator.swift

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -186,25 +186,12 @@ final class TableViewCoordinator: NSObject, NSTableViewDelegate, NSTableViewData
186186
}
187187
}
188188

189-
func observeTeardown(connectionId: UUID) {
190-
teardownCancellable = AppEvents.shared.mainCoordinatorTeardown
191-
.filter { $0.connectionId == connectionId }
192-
.receive(on: RunLoop.main)
193-
.sink { [weak self] _ in
194-
Task {
195-
self?.releaseData()
196-
}
197-
}
198-
}
199-
200-
private func releaseData() {
189+
func releaseData() {
201190
overlayEditor?.dismiss(commit: false)
202191
settingsCancellable?.cancel()
203192
settingsCancellable = nil
204193
themeCancellable?.cancel()
205194
themeCancellable = nil
206-
teardownCancellable?.cancel()
207-
teardownCancellable = nil
208195
visualIndex.clear()
209196
displayCache.removeAllObjects()
210197
columnDisplayFormats = []
@@ -224,8 +211,6 @@ final class TableViewCoordinator: NSObject, NSTableViewDelegate, NSTableViewData
224211
activeFKPreviewPopover = nil
225212
}
226213

227-
private(set) var teardownCancellable: AnyCancellable?
228-
229214
func updateCache() {
230215
let tableRows = tableRowsProvider()
231216
cachedRowCount = sortedIDs?.count ?? tableRows.count

TablePro/Views/Results/DataGridRowView.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
//
55

66
import AppKit
7+
import Combine
78

89
@MainActor
910
final class DataGridRowView: NSTableRowView {
@@ -339,7 +340,7 @@ final class DataGridRowView: NSTableRowView {
339340
}
340341

341342
@objc private func exportResults() {
342-
NotificationCenter.default.post(name: .exportQueryResults, object: nil)
343+
AppCommands.shared.exportQueryResults.send(())
343344
}
344345

345346
@objc private func copyAsJson() {

TablePro/Views/Results/DataGridView.swift

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -124,9 +124,6 @@ struct DataGridView: NSViewRepresentable {
124124
context.coordinator.tableName = configuration.tableName
125125
context.coordinator.primaryKeyColumns = configuration.primaryKeyColumns
126126
context.coordinator.tabType = configuration.tabType
127-
if let connectionId = configuration.connectionId {
128-
context.coordinator.observeTeardown(connectionId: connectionId)
129-
}
130127

131128
return scrollView
132129
}
@@ -160,10 +157,6 @@ struct DataGridView: NSViewRepresentable {
160157
}
161158
}
162159

163-
if let connectionId = configuration.connectionId, coordinator.teardownCancellable == nil {
164-
coordinator.observeTeardown(connectionId: connectionId)
165-
}
166-
167160
let latestRows = tableRowsProvider()
168161
let rowDisplayCount = sortedIDs?.count ?? latestRows.count
169162
let columnCount = latestRows.columns.count

0 commit comments

Comments
 (0)