Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -982,7 +982,6 @@ internal final class MainSplitViewController: NSSplitViewController {
windowTitle: windowTitleBinding(for: workspace),
windowSubtitle: windowSubtitleBinding(for: workspace),
windowRepresentedURL: windowRepresentedURLBinding(for: workspace),
sidebarState: SharedSidebarState.forConnection(session.connection.id),
pendingTruncates: sessionBinding(for: workspace, get: { $0.pendingTruncates }, set: { $0.pendingTruncates = $1 }, defaultValue: []),
pendingDeletes: sessionBinding(for: workspace, get: { $0.pendingDeletes }, set: { $0.pendingDeletes = $1 }, defaultValue: []),
tableOperationOptions: sessionBinding(for: workspace, get: { $0.tableOperationOptions }, set: { $0.tableOperationOptions = $1 }, defaultValue: [:]),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import SwiftUI
windowTitle: .constant("SQL Query"),
windowSubtitle: .constant(""),
windowRepresentedURL: .constant(nil),
sidebarState: SharedSidebarState(),
pendingTruncates: .constant([]),
pendingDeletes: .constant([]),
tableOperationOptions: .constant([:]),
Expand Down
3 changes: 0 additions & 3 deletions apple/TablePro/Views/Main/MainContentView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ struct MainContentView: View {
@Binding var windowSubtitle: String
@Binding var windowRepresentedURL: URL?
@ObservedObject var schemaService = SchemaService.shared
@ObservedObject var sidebarState: SharedSidebarState
@Binding var pendingTruncates: Set<DatabaseTreeTableRef>
@Binding var pendingDeletes: Set<DatabaseTreeTableRef>
@Binding var tableOperationOptions: [DatabaseTreeTableRef: TableOperationOptions]
Expand Down Expand Up @@ -59,7 +58,6 @@ struct MainContentView: View {
windowTitle: Binding<String>,
windowSubtitle: Binding<String>,
windowRepresentedURL: Binding<URL?>,
sidebarState: SharedSidebarState,
pendingTruncates: Binding<Set<DatabaseTreeTableRef>>,
pendingDeletes: Binding<Set<DatabaseTreeTableRef>>,
tableOperationOptions: Binding<[DatabaseTreeTableRef: TableOperationOptions]>,
Expand All @@ -74,7 +72,6 @@ struct MainContentView: View {
self._windowTitle = windowTitle
self._windowSubtitle = windowSubtitle
self._windowRepresentedURL = windowRepresentedURL
self.sidebarState = sidebarState
self._pendingTruncates = pendingTruncates
self._pendingDeletes = pendingDeletes
self._tableOperationOptions = tableOperationOptions
Expand Down
5 changes: 4 additions & 1 deletion apple/TablePro/Views/Sidebar/DatabaseTreeNode.swift
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,9 @@ internal struct DatabaseTreeSidePhases: Equatable {
}
}

final class DatabaseTreeNode: SidebarOutlineNode {
// NSObject so the outline's item lookups hash the pointer: a plain Swift class looks up a Hashable conformance on
// every hash, about a quarter of opening a section of 17,000 tables.
final class DatabaseTreeNode: NSObject, SidebarOutlineNode {
enum Status: Equatable {
case loading
case empty
Expand Down Expand Up @@ -110,6 +112,7 @@ final class DatabaseTreeNode: SidebarOutlineNode {
init(id: String, kind: Kind) {
self.id = id
self.kind = kind
super.init()
}

var isExpandable: Bool {
Expand Down
4 changes: 3 additions & 1 deletion apple/TablePro/Views/Sidebar/FavoritesOutlineNode.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ import Foundation
/// A reference type because `NSOutlineView` tracks rows by object identity, which is what lets a
/// reload keep the expansion and selection a user set. The coordinator caches these by `id` and
/// mutates the cached instance rather than building a new one, exactly as the object tree does.
internal final class FavoritesOutlineNode: SidebarOutlineNode {
/// An `NSObject` for the same cheap hashing as `DatabaseTreeNode`.
internal final class FavoritesOutlineNode: NSObject, SidebarOutlineNode {
internal enum Kind {
case header(String)
case databaseEnvironment(FavoriteDatabaseGroup)
Expand All @@ -26,6 +27,7 @@ internal final class FavoritesOutlineNode: SidebarOutlineNode {
internal init(id: String, kind: Kind) {
self.id = id
self.kind = kind
super.init()
}

internal var isExpandable: Bool {
Expand Down
1 change: 1 addition & 0 deletions apple/changelog.d/3876.changed.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Typing in the sidebar filter no longer redraws the editor and results on every keystroke.
Loading