Skip to content

fix(compass-sidebar): connection search empty state for invalid patterns COMPASS-9970#8016

Draft
cursor[bot] wants to merge 1 commit intomainfrom
cursor/connections-search-no-results-9b43
Draft

fix(compass-sidebar): connection search empty state for invalid patterns COMPASS-9970#8016
cursor[bot] wants to merge 1 commit intomainfrom
cursor/connections-search-no-results-9b43

Conversation

@cursor
Copy link
Copy Markdown
Contributor

@cursor cursor Bot commented Apr 23, 2026

Description

The connections sidebar already shows No results found. when a valid search yields no matches. If the user typed a non-empty string that is not a valid regular expression (for example an unmatched (), createRegExp returned null, the filter hook treated that as “not filtering”, and the UI fell back to the full connection list—often feeling like “nothing happened” or an ambiguous loading state.

This change:

  • Stores the raw searchText from the search field on ConnectionsFilter.
  • When searchText is non-empty and regex is null, keeps filtering active and applies a never-match pattern so filtered is an empty array and the existing empty state (data-testid="no-search-results") renders.
  • Runs the filter sync in useLayoutEffect so the filtered list updates in the same paint as the input, reducing a brief flash of stale (unfiltered) results.

Checklist

  • New tests and/or benchmarks are included
  • Documentation is changed or added
  • If this change updates the UI, screenshots/videos are added and a design review is requested
  • If this change could impact the load on the MongoDB cluster, please describe the expected and worst case impact
  • I have signed the MongoDB Contributor License Agreement (https://www.mongodb.com/legal/contributor-agreement)

Motivation and Context

Addresses COMPASS-9970: make it clear when a connections search has no results, including invalid search patterns.

  • Bugfix
  • New feature
  • Dependency update
  • Misc

Open Questions

None.

Dependents

None.

Types of changes

  • Backport Needed
  • Patch (non-breaking change which fixes an issue)
  • Minor (non-breaking change which adds functionality)
  • Major (fix or feature that would cause existing functionality to change)
Open in Web Open in Cursor 

When the search field contains a non-empty string that does not compile as a
RegExp, keep filtering active so users see "No results found." instead of the
full list. Sync filter updates in useLayoutEffect to reduce a one-frame flash
of stale results.

COMPASS-9970
@github-actions github-actions Bot added the fix label Apr 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant