Skip to content

Prevent tab search results from jumping while typing - #15133

Merged
AmethystLiang merged 2 commits into
mainfrom
fix-jumpy-search-tab
Aug 18, 2026
Merged

AmethystLiang merged 2 commits into
mainfrom
fix-jumpy-search-tab

Conversation

@AmethystLiang

@AmethystLiang AmethystLiang commented Aug 17, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 2 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​337 $\color{#cf222e}{\Huge{\mathbf{−}}}$​5 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​332
Prod 4 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​102 $\color{#cf222e}{\Huge{\mathbf{−}}}$​14 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​88

Problem

When users type in the tab search field, results are deferred (async). While waiting, if they continue typing, the old logic would clear deferred results whenever the live query didn't exactly match, causing the list to flash and jump on every keystroke.

Solution

Introduces a retention strategy that keeps deferred results on screen if they still match the current query:

  • If current query is a prefix of deferred query (e.g., user backspaces from "add tab" to "add ta")
  • If result's title, matchedText, or relativePath still contains the current query

This eliminates visual jumping while maintaining correctness—Enter only submits tabs that match.

What Changed

  • open-tab-search-retention.ts: Core logic to determine which deferred results to keep
  • use-tab-create-entry-search-results.ts: React hook applying retention logic
  • TabBarCreateEntry.tsx: Updated to use new hook instead of clearing results
  • Tests refactored to verify kept vs dropped rows

Testing

  • Added unit tests for all retention scenarios (prefix match, secondary text match, dropped rows)
  • Existing tab search tests updated to verify no spurious submission

Checklist

  • This PR is small and focused
  • I explained what changed and why (including ELI5)
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)

Notes

Ensure no issues in: Security, Cross-platform support (Linux, Windows, Mac), Remote SSH, Mobile, general backwards compatibility, performance

- Retain deferred results that still match the current query
- Add retainOpenTabResultsForQuery utility with query matching logic
- Refactor TabBarCreateEntry to use useTabCreateEntrySearchResults hook
@coderabbitai

coderabbitai Bot commented Aug 17, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 34372cbc-98f2-439c-b46c-7174b46c4764

📥 Commits

Reviewing files that changed from the base of the PR and between a1cd7ea and 91faae7.

📒 Files selected for processing (5)
  • src/renderer/src/components/tab-bar/TabBarCreateEntry.tab-results.test.tsx
  • src/renderer/src/components/tab-bar/TabBarCreateEntry.tsx
  • src/renderer/src/components/tab-bar/open-tab-search-retention.test.ts
  • src/renderer/src/components/tab-bar/open-tab-search-retention.ts
  • src/renderer/src/components/tab-bar/use-tab-create-entry-search-results.ts

Included review availability: Your plan includes up to 10 reviews per rolling hour; 9 remain after this review.


📝 Walkthrough

Walkthrough

The change adds query-aware retention for deferred open-tab search results. It preserves results for unchanged or shortened queries, filters results by title, matched text, or relative path, and clears results for blank queries. A new hook applies this logic when tab creation search is enabled. TabBarCreateEntry uses the hook and activates retained tab results. Tests cover retention behavior and deferred result selection.

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Description check ⚠️ Warning The description explains the problem, solution, changes, and testing, but it omits several required template sections and leaves all checklist items unchecked. Add the ELI5, Why, Linked Issue, Visual Proof or N/A, AI Disclosure, Review, Agent skill boundary, Author, and completed checklist sections.
✅ Passed checks (3 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly describes the main change: preventing tab search results from flashing or jumping during typing.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

Instead of checking if row text contains the query, retention now
re-runs the search engines on deferred results. This respects all
matching rules (type aliases, paths, workspace labels, agent snippets)
and ensures stale or mismatched rows don't linger on screen as the
user types.
@AmethystLiang
AmethystLiang merged commit 9b8e9dc into main Aug 18, 2026
45 checks passed
nwparker added a commit that referenced this pull request Aug 18, 2026
Same #15133/#15170 collision as the retention test: the hoisted
useOpenTabSearch mock builds workspace tab entries with no document, so
retention re-matching throws on document.fields.
paidaxingyo666 pushed a commit to paidaxingyo666/Manta that referenced this pull request Aug 21, 2026
* Prevent tab search results from jumping while typing

- Retain deferred results that still match the current query
- Add retainOpenTabResultsForQuery utility with query matching logic
- Refactor TabBarCreateEntry to use useTabCreateEntrySearchResults hook

* Re-check retained tab search rows with full search engines

Instead of checking if row text contains the query, retention now
re-runs the search engines on deferred results. This respects all
matching rules (type aliases, paths, workspace labels, agent snippets)
and ensures stale or mismatched rows don't linger on screen as the
user types.
dallascrilley pushed a commit to dallascrilley/orca that referenced this pull request Aug 27, 2026
* Prevent tab search results from jumping while typing

- Retain deferred results that still match the current query
- Add retainOpenTabResultsForQuery utility with query matching logic
- Refactor TabBarCreateEntry to use useTabCreateEntrySearchResults hook

* Re-check retained tab search rows with full search engines

Instead of checking if row text contains the query, retention now
re-runs the search engines on deferred results. This respects all
matching rules (type aliases, paths, workspace labels, agent snippets)
and ensures stale or mismatched rows don't linger on screen as the
user types.
enrick-dev pushed a commit to enrick-dev/orca that referenced this pull request Oct 15, 2026
* Prevent tab search results from jumping while typing

- Retain deferred results that still match the current query
- Add retainOpenTabResultsForQuery utility with query matching logic
- Refactor TabBarCreateEntry to use useTabCreateEntrySearchResults hook

* Re-check retained tab search rows with full search engines

Instead of checking if row text contains the query, retention now
re-runs the search engines on deferred results. This respects all
matching rules (type aliases, paths, workspace labels, agent snippets)
and ensures stale or mismatched rows don't linger on screen as the
user types.
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