fix: keep sidebar filter when opening a table from the filtered list#1707
Open
mvanhorn wants to merge 2 commits into
Open
fix: keep sidebar filter when opening a table from the filtered list#1707mvanhorn wants to merge 2 commits into
mvanhorn wants to merge 2 commits into
Conversation
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
Contributor
|
All contributors have signed the CLA ✍️ ✅ |
Signed-off-by: Ngô Quốc Đạt <datlechin@gmail.com>
Author
|
I have read the CLA Document and I hereby sign the CLA. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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. TheNSSearchFieldDelegate.searchFieldDidEndSearching(_:)callback unconditionally wrote""back to the persisted search text. When a table is opened, focus leaves the search field, AppKit firessearchFieldDidEndSearching, 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
stringValueis 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 --strictpasses on the touched files.TableProTests/Views/SidebarSearchPersistenceTests.swiftcovering the decision: keep the filter when the field still has text, clear it when the field is empty.nonisolatedhelper (shouldClearOnEndSearching) so it is unit-testable without standing up AppKit.Fixes #1690