Skip to content
Closed
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Fixed

- The sidebar filter no longer clears when you open a table from the filtered list. It only clears when you empty the field. (#1690)
- Redis entries no longer disappear after the connection sits idle. The health check was running `SELECT 1`, which on Redis switches the active database, so a later refresh scanned the wrong database. (#1701)
- Redis key browsing now lists every key in a database or namespace and pages through them correctly. It was reading only the first SCAN batch, so large keyspaces showed a partial, fixed set of keys. (#1701)
- A dropped Redis connection now reconnects on the next command and replays auth and the selected database, instead of failing until the next health check. (#1701)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,9 +131,14 @@ extension SidebarContainerViewController: NSSearchFieldDelegate {
}

func searchFieldDidEndSearching(_ sender: NSSearchField) {
guard Self.shouldClearOnEndSearching(fieldValue: sender.stringValue) else { return }
writeSearchText("")
}

nonisolated static func shouldClearOnEndSearching(fieldValue: String) -> Bool {
fieldValue.isEmpty
}

func control(_ control: NSControl, textView: NSTextView, doCommandBy commandSelector: Selector) -> Bool {
guard commandSelector == #selector(NSResponder.moveDown(_:)) else { return false }
view.window?.makeFirstResponder(hostingController.view)
Expand Down
27 changes: 27 additions & 0 deletions TableProTests/Views/SidebarSearchPersistenceTests.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
//
// SidebarSearchPersistenceTests.swift
// TableProTests
//
// Regression guard for #1690 where opening a table from a filtered sidebar
// cleared the active filter. searchFieldDidEndSearching fired on focus loss
// and wrote "" back over the persisted filter text. The filter must only be
// cleared when the field is actually empty (cancel button / explicit clear).
//

import Foundation
import Testing

@testable import TablePro

@Suite("Sidebar search persistence on end editing")
struct SidebarSearchPersistenceTests {
@Test("keeps the filter when the field still has text and focus is lost")
func keepsFilterWhenFieldHasText() {
#expect(!SidebarContainerViewController.shouldClearOnEndSearching(fieldValue: "dp_"))
}

@Test("clears the filter when the field is empty")
func clearsFilterWhenFieldEmpty() {
#expect(SidebarContainerViewController.shouldClearOnEndSearching(fieldValue: ""))
}
}
Loading