Skip to content

fix(sidebar): keep the table filter when opening another tab#1715

Merged
datlechin merged 2 commits into
mainfrom
fix/sidebar-filter-across-tabs
Jun 18, 2026
Merged

fix(sidebar): keep the table filter when opening another tab#1715
datlechin merged 2 commits into
mainfrom
fix/sidebar-filter-across-tabs

Conversation

@datlechin

Copy link
Copy Markdown
Member

Problem

Filter the sidebar table list, open a table, then open a second table tab: the new tab's sidebar shows no filter, so the filter text and the filtered list appear lost.

Root cause

The sidebar filter text (searchText, favoritesSearchText) lived in WindowSidebarState, which MainContentCoordinator creates fresh per window tab. TablePro tabs are native NSWindow tabs, so opening a second table tab spins up a new coordinator with an empty filter. The rest of the connection-scoped sidebar state (layout, selected tab, database filter) already lives in SharedSidebarState; the filter text was the outlier.

Fix

Move the two filter-text fields from WindowSidebarState to SharedSidebarState, the per-connection registry shared across all tabs/windows of a connection. Table selection (selectedTables) and tree-expansion state stay window-scoped, so the #1313 Cmd+T focus regression is untouched.

  • SharedSidebarState gains searchText / favoritesSearchText; WindowSidebarState drops them.
  • SidebarContainerViewController reads/writes/observes the filter on the shared state and no longer needs the window state.
  • MainSplitViewController callers updated.
  • SidebarView / FavoritesTabView read the filter from the shared state.

Tests

  • Moved the per-window search assertions into SharedSidebarStateTests (persist across tabs of the same connection, independent across connections). Kept the selectedTables per-window test that guards SQLite new query tab auto jump to other tab #1313.
  • swiftlint lint --strict clean on changed files.
  • The test target does not compile locally under the only installed toolchain (Xcode-beta) due to a pre-existing, unrelated @MainActor isolation error in DatabaseTreeMetadataServiceTests, so the suite was not run locally. CI on the stable toolchain should run it.

@datlechin datlechin merged commit f60228e into main Jun 18, 2026
2 of 3 checks passed
@datlechin datlechin deleted the fix/sidebar-filter-across-tabs branch June 18, 2026 10:34
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.

1 participant