Skip to content

Commit 9493b95

Browse files
committed
fix: address review feedback on anti-patterns PR
- WindowAccessor: deduplicate viewDidMoveToWindow calls, update closure in updateNSView - AIChatViewModel: add comment explaining nonisolated(unsafe) requirement - CHANGELOG: add user-visible behavioral changes under [Unreleased]
1 parent f7e276e commit 9493b95

3 files changed

Lines changed: 14 additions & 4 deletions

File tree

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1111

1212
- MongoDB Atlas connections failing to authenticate (#438)
1313
- MongoDB TLS certificate verification skipped for SRV connections
14+
- Active tab data no longer refreshes when switching back to the app window
15+
- Undo history preserved when switching between database tables
16+
- Health monitor now detects stuck queries beyond the configured timeout
17+
- SSH tunnel closure errors now logged instead of silently discarded
18+
- Schema/database restore errors during reconnect now logged
1419

1520
## [0.23.1] - 2026-03-24
1621

TablePro/ViewModels/AIChatViewModel.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,8 @@ final class AIChatViewModel {
8888

8989
// MARK: - Private
9090

91+
/// nonisolated(unsafe) is required because deinit is not @MainActor-isolated,
92+
/// so accessing a @MainActor property from deinit requires opting out of isolation.
9193
@ObservationIgnored nonisolated(unsafe) private var streamingTask: Task<Void, Never>?
9294
private var streamingAssistantID: UUID?
9395
private var lastUsedFeature: AIFeature = .chat

TablePro/Views/Components/WindowAccessor.swift

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,19 @@ struct WindowAccessor: NSViewRepresentable {
1313
return view
1414
}
1515

16-
func updateNSView(_ nsView: WindowAccessorView, context: Context) {}
16+
func updateNSView(_ nsView: WindowAccessorView, context: Context) {
17+
nsView.onWindow = onWindow
18+
}
1719
}
1820

1921
final class WindowAccessorView: NSView {
2022
var onWindow: ((NSWindow) -> Void)?
23+
private weak var capturedWindow: NSWindow?
2124

2225
override func viewDidMoveToWindow() {
2326
super.viewDidMoveToWindow()
24-
if let window {
25-
onWindow?(window)
26-
}
27+
guard let window, window !== capturedWindow else { return }
28+
capturedWindow = window
29+
onWindow?(window)
2730
}
2831
}

0 commit comments

Comments
 (0)