Skip to content

fix(search): stop type-ahead search from polluting browser history#3118

Open
leno23 wants to merge 1 commit into
rust-lang:masterfrom
leno23:fix/search-history-replace-2635
Open

fix(search): stop type-ahead search from polluting browser history#3118
leno23 wants to merge 1 commit into
rust-lang:masterfrom
leno23:fix/search-history-replace-2635

Conversation

@leno23
Copy link
Copy Markdown

@leno23 leno23 commented May 17, 2026

Summary

  • Use history.replaceState (via setSearchUrlParameters(..., 'replace')) on each keypress while searching
  • Previously the first keystroke used pushState, adding a history entry per new search session and cluttering the browser history list

Motivation

Type-ahead search updated ?search= on every keystroke; even with replace for subsequent keys, the initial pushState and URL churn created noisy history (#2635, reported by @ehuss).

Test plan

  • cargo test --test testsuite
  • Manual: type in search box, confirm browser history dropdown is not filled with partial queries

Fixes #2635

Made with Cursor

Updating the URL on each keypress used pushState for the first
character, which polluted the browser history list. Always use
replaceState while typing; Escape still uses push when closing a
non-empty search so Back can restore the query.

Fixes rust-lang#2635

Co-authored-by: Cursor <cursoragent@cursor.com>
@rustbot rustbot added the S-waiting-on-review Status: waiting on a review label May 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-review Status: waiting on a review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Don't include type-ahead search in the browser history

2 participants