Skip to content

fix(web): keep selected search filters visible - #1685

Open
dipeshbabu wants to merge 3 commits into
sourcebot-dev:mainfrom
dipeshbabu:dipeshbabu/fix-selected-search-filters-131
Open

dipeshbabu wants to merge 3 commits into
sourcebot-dev:mainfrom
dipeshbabu:dipeshbabu/fix-selected-search-filters-131

Conversation

@dipeshbabu

@dipeshbabu dipeshbabu commented Sep 24, 2026 •

Copy link
Copy Markdown

Fixes #131

Typing into the language or repository filter hid selected entries that did not match the filter text. Keep those selections visible at the top so users can see and clear every active filter, while filtering the remaining entries normally.

Selected entries appear only once when they also match the search. Sorting now copies the list instead of mutating the caller's entries.

Validation completed before opening this PR:


Note

Low Risk
Localized UI change to search filter panel list rendering with regression tests; no auth, API, or data-path impact.

Overview
Fixes a search sidebar bug where typing in the language or repository filter box could hide active selections that did not match the search text, making them hard to see or clear.

Filter list behavior now always pins selected entries ahead of Fuse matches on the non-selected remainder, keeps selections visible when nothing else matches, and avoids duplicate rows when a selected item also matches. Display sorting copies the filtered array before sort so the parent entries array is not mutated in place.

Adds Vitest coverage for these cases and a changelog entry under Unreleased.

Reviewed by Cursor Bugbot for commit 0bb329b. Bugbot is set up for automated code reviews on this repo. Configure here.


Summary by cubic

Fixes #131 by keeping selected language and repository filters visible at the top while typing, so active filters can always be seen and cleared.

  • Selected entries stay pinned above search matches and appear only once when they also match or when no other entries match.
  • Sorting copies the entries list instead of mutating the caller's array.
  • Adds Vitest coverage for pinned selections and a changelog entry.

Written for commit 82ac4e2. Summary will update on new commits.

Review in cubic

Summary by CodeRabbit

  • Bug Fixes
    • Selected language and repository filters remain visible while searching available options, even when they don’t match the search text.
    • Selected filters appear before matching unselected options, and selected options that match the search are shown only once.
    • Searching with no matching options still preserves selected filters while hiding unselected options.

@coderabbitai

coderabbitai Bot commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: b82f6747-7987-46be-a9ef-212447c00dc4

📥 Commits

Reviewing files that changed from the base of the PR and between 82ac4e2 and 0bb329b.

📒 Files selected for processing (1)
  • CHANGELOG.md
🚧 Files skipped from review as they are similar to previous changes (1)
  • CHANGELOG.md

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.


Walkthrough

The search filter now keeps selected entries visible and places them before fuzzy matches. It sorts a copy of the filtered list. Tests cover filtering, entry ordering, click callbacks, duplicate prevention, and preservation of the input array.

Changes

Selected search entries

Layer / File(s) Summary
Selected entries in filtered results
packages/web/src/app/(app)/search/components/filterPanel/filter.tsx, packages/web/src/app/(app)/search/components/filterPanel/filter.test.tsx, CHANGELOG.md
Selected entries remain visible and appear before fuzzy matches for unselected entries. The component sorts a copy of the filtered list. Tests cover visibility, ordering, click callbacks, duplicate prevention, and input-array preservation. The changelog records the fix.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix · Severity of issue fixed: Low

Merge Risk: ⚪ Minimal · up to 0bb32

The change keeps selected filters visible while preserving normal filtering and click behavior. No actionable merge-blocking risk remains; merge after normal checks pass.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: keeping selected search filters visible in the web application.
Linked Issues check ✅ Passed Issue #131 requires selected languages to remain visible at the top during filtering. The Filter component now retains selected entries, places them first, filters only unselected entries, and preve…
Out of Scope Changes check ✅ Passed The changes remain connected to issue #131. The component change implements selected-entry visibility, the tests verify the behavior and sorting safety, and the changelog documents the fix. The reposi…
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 2…
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR

Comment @coderabbitai help to get the list of available commands.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 3 files

Re-trigger cubic

This branch has not been deployed

No deployments
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.

Filtering languages hides already selected langs

1 participant