File tree Expand file tree Collapse file tree
TablePro/Core/Services/Infrastructure Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -14,6 +14,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1414
1515### Fixed
1616
17+ - The sidebar filter no longer clears when you open a table from the filtered list. It only clears when you empty the field. (#1690 )
1718- DuckDB VARIANT columns now show their value as text instead of an empty cell.
1819
1920## [ 0.51.1] - 2026-06-16
Original file line number Diff line number Diff line change @@ -131,9 +131,14 @@ extension SidebarContainerViewController: NSSearchFieldDelegate {
131131 }
132132
133133 func searchFieldDidEndSearching( _ sender: NSSearchField ) {
134+ guard Self . shouldClearOnEndSearching ( fieldValue: sender. stringValue) else { return }
134135 writeSearchText ( " " )
135136 }
136137
138+ nonisolated static func shouldClearOnEndSearching( fieldValue: String ) -> Bool {
139+ fieldValue. isEmpty
140+ }
141+
137142 func control( _ control: NSControl , textView: NSTextView , doCommandBy commandSelector: Selector ) -> Bool {
138143 guard commandSelector == #selector( NSResponder . moveDown ( _: ) ) else { return false }
139144 view. window? . makeFirstResponder ( hostingController. view)
Original file line number Diff line number Diff line change 1+ //
2+ // SidebarSearchPersistenceTests.swift
3+ // TableProTests
4+ //
5+ // Regression guard for #1690 where opening a table from a filtered sidebar
6+ // cleared the active filter. searchFieldDidEndSearching fired on focus loss
7+ // and wrote "" back over the persisted filter text. The filter must only be
8+ // cleared when the field is actually empty (cancel button / explicit clear).
9+ //
10+
11+ import Foundation
12+ import Testing
13+
14+ @testable import TablePro
15+
16+ @Suite ( " Sidebar search persistence on end editing " )
17+ struct SidebarSearchPersistenceTests {
18+ @Test ( " keeps the filter when the field still has text and focus is lost " )
19+ func keepsFilterWhenFieldHasText( ) {
20+ #expect( !SidebarContainerViewController. shouldClearOnEndSearching ( fieldValue: " dp_ " ) )
21+ }
22+
23+ @Test ( " clears the filter when the field is empty " )
24+ func clearsFilterWhenFieldEmpty( ) {
25+ #expect( SidebarContainerViewController . shouldClearOnEndSearching ( fieldValue: " " ) )
26+ }
27+ }
You can’t perform that action at this time.
0 commit comments