Skip to content

fix: keep sidebar filter when opening a table from the filtered list#1707

Open
mvanhorn wants to merge 2 commits into
TableProApp:mainfrom
mvanhorn:fix/1690-sidebar-filter-cleared-on-table-open
Open

fix: keep sidebar filter when opening a table from the filtered list#1707
mvanhorn wants to merge 2 commits into
TableProApp:mainfrom
mvanhorn:fix/1690-sidebar-filter-cleared-on-table-open

Conversation

@mvanhorn

Copy link
Copy Markdown

Summary

In the tables sidebar, typing a filter and then double-clicking a table to open it cleared the active filter text. The table opened but the filter was wiped.

Root cause is in SidebarContainerViewController. The NSSearchFieldDelegate.searchFieldDidEndSearching(_:) callback unconditionally wrote "" back to the persisted search text. When a table is opened, focus leaves the search field, AppKit fires searchFieldDidEndSearching, and the filter was cleared even though the field still held text.

The fix guards that callback so it only clears the persisted text when the field's stringValue is actually empty (the cancel/clear path leaves an empty value). The live-typing path (controlTextDidChange) is untouched, so typing and clearing via the cancel button still work, and tab scoping between the tables and favorites filters is preserved.

Why this matters

The maintainer confirmed in #1690 that the filter pane is scoped per table tab and is expected to persist. Prefix filtering (for example dp_) should survive opening a table; clearing it on every open made the feature unusable for its main purpose.

Testing

  • swiftlint lint --strict passes on the touched files.
  • Added TableProTests/Views/SidebarSearchPersistenceTests.swift covering the decision: keep the filter when the field still has text, clear it when the field is empty.
  • The clear decision is extracted into a pure nonisolated helper (shouldClearOnEndSearching) so it is unit-testable without standing up AppKit.

Fixes #1690

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Credits must be used to enable repository wide code reviews.

@github-actions

github-actions Bot commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

Signed-off-by: Ngô Quốc Đạt <datlechin@gmail.com>
@mvanhorn

Copy link
Copy Markdown
Author

I have read the CLA Document and I hereby sign the CLA.

github-actions Bot added a commit that referenced this pull request Jun 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Filter table issue

2 participants