Repository navigation
fix(search): prevent submissions while the prompt is loading - #2291
Merged
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2291 +/- ##
=======================================
Coverage ? 89.30%
=======================================
Files ? 51
Lines ? 2290
Branches ? 608
=======================================
Hits ? 2045
Misses ? 236
Partials ? 9 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Consolidate the regression tests into two flows using withResolver, exposed from @inquirer/type so all packages can use it until Node 22 becomes the minimum supported version. Co-authored-by: Simon Boudrias <[email protected]>
SBoudrias
force-pushed
the
fix-search-stale-selection
branch
from
October 4, 2026 16:57
952a3f1 to
1f804ec
Compare
Owner
|
Thanks! Good catch! |
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.
Pressing Enter while an async search is still loading could submit a choice from the previous query. A prompt showing Alberta would return Alberta after typing
Queand pressing Enter before the Quebec results arrived. Repeated Enter presses could also run an async validator more than once.Only submit a selected choice when the prompt is idle. While it is busy, the existing fallback restores the search term after readline clears it, so typing can continue without losing the query.
Added regressions through the public prompt test interface for stale results, keeping the query after an early Enter, and repeated Enter during validation. A standalone Node reproduction also returned Alberta on unchanged source and Quebec with the fix.
Fixes #2290
Terminal reproduction: https://gist.github.com/imharjot/72b8987f390e679008abff6f185f508a
Validation on Node 24.11.1 with Yarn 4.18.1:
yarn pretestTERM=xterm-256color yarn test— 436 unit tests passed, one existing skip; CJS 5/5 and ESM 7/7TERM=xterm-256color yarn vitest --run --coverageyarn package lint --checkyarn setup— no changes to the reviewed patchThe normal terminal setting is needed by the legacy i18n test wrapper for simulated backspaces. With
TERM=dumb, four localized confirm retry tests also time out on unchanged upstream source.