fix: clear input function in Repository searchbox#1283
Merged
e35ventura merged 1 commit intoMay 28, 2026
Conversation
e35ventura
approved these changes
May 28, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes the X (clear) button in the search input on
/repositories. Previously, clicking X would clear the field for a single frame and then the previous search term reappeared, with?search=…immediately restored in the URL. The button is now a real no-op-free clear: input empties, URL param is removed, full list shows.Root cause was a callback-identity cascade in
DebouncedSearchInput:setSearchParamsis rebuilt on every URL change, so any callback derived from it (setFilter→handleSearchChange→ theonDebouncedChangeprop) gets a new reference per URL update.DebouncedSearchInput's fire-effect hadonDebouncedChangein its dep array, so it re-ran with the staledebouncedvalue the moment the URL changed — re-applying the old search term right after the clear.Fix uses the latest-ref pattern in
src/components/common/DebouncedSearchInput.tsx: the fire-effect now depends only ondebounced, while the callback is read from a ref kept in sync via a separate effect. This fixes the bug at the source and protects every other caller (IssuesList,RepositoryPRsTable,RepositoryCodeBrowser,LanguageWeightsTable,MinerPRsTable,MinerOpenDiscoveryIssuesByRepo,WatchlistPage) from the same trap.Related Issues
Fixes #1282
Type of Change
Screenshots
Before — clicking X briefly clears the input, then
gitreappears and?search=gitis restored:before.webm
After — clicking X clears the input and removes
?search=from the URL:after.webm
Checklist
npm run formatandnpm run lint:fixhave been runnpm run buildpasses