Skip to content

fix(Typeahead): preserve pending searches across source replacement - #8017

Merged
imdreamrunner merged 1 commit into
stack/pr-6360-basefrom
fix/typeahead-pending-search-6360
Oct 23, 2026
Merged

imdreamrunner merged 1 commit into
stack/pr-6360-basefrom
fix/typeahead-pending-search-6360

Conversation

@imdreamrunner

Copy link
Copy Markdown
Contributor

User impact

Stacked follow-up to #6360. A caller that constructs searchSource inline and updates state in onChangeQuery can type normally but never receive suggestions: the parent render replaces the source during the debounce delay.

This PR restores pending typed searches in BaseTypeahead, Typeahead, and Tokenizer without changing their selection behavior.

Problem and solution fit

The source-replacement effect called the same invalidation path as a terminal close. That canceled an input-owned debounce timer even though its query still needed searching. No request ran, so the person could not find or choose a value.

A replacement now invalidates and releases started old-source work, but leaves the pending timer at its original deadline. When the timer fires, search/bootstrap use the latest committed source.

Expected behavior and authority

component:Tokenizer AV6 and DEC-2 require preserving typed-query and direct single-select behavior. The existing default-debounce source interface permits a source supplied during render; recreating it must not silently discard an unstarted query.

architecture:react-component-runtime INV3–INV5 governs request/timer ownership and committed source synchronization.

Smallest restoration

  • Keep the pending debounce timer through source replacement; do not restart its delay.
  • Read the latest committed source when starting search or bootstrap.
  • Keep generation guards and old-source cancellation, plus existing terminal cleanup.
  • Add focused regression coverage, project the restoration into consumer docs, and include a core patch changeset.

Other review findings in #6360 are outside this follow-up: this does not change highlight-state representation, restore the original cancellation callback ordering, trim the parent PR, or rebase it onto main.

Evidence

  • Reproduction before the change: all four focused cases fail because the pending search is called zero times. Real Chromium also fails all four inline-source typed-selection cases on the parent implementation.
  • Result after the change: pending queries search the latest source once, at the original deadline; suggestions appear and typing remains intact.
  • Representative unchanged path: direct single-select still commits, clears, and closes. Tokenizer focus-bootstrap selection keeps the remaining loaded option open and active; exhaustion, maximum, disablement, and dismissal still close safely.
  • Regression test: explicit replacement halfway through the debounce delay, plus onChangeQuery-driven inline-source recreation across all three components.

Browser evidence

Chromium 144.0.7559.133, neutral theme, light mode, LTR, 1280×800 at DPR 1, fine pointer/hover, no forced colors or reduced motion. Every frame checked the rendered theme, computed mode/direction, query value, focus, option count, active descendant, visible non-zero subject geometry, settled fonts, and absence of visible error screens/page errors. Typed-query pairs differ only in whether results appear; the retained-selection pair is pixel-identical.

Before arm: exact parent implementation plus the same inline-source story fixture used after. After arm: fix commit 469b34137fc750f03f39b4ddab1847969f318adf. No unrelated production delta.

Before/after frames: typed searches restored; retained selection unchanged
Case Before After
Typeahead: “React” Before: typed React has no suggestions After: React suggestion appears
Tokenizer: “Alice” Before: typed Alice has no suggestions After: Alice Johnson suggestion appears
Tokenizer bootstrap: Alice selected Before: Bob remains open and active After: Bob remains open and active, pixel-identical
Capture sensor receipts
Sensor Expected Observed Result
Build Parent implementation vs 469b34137fc750f03f39b4ddab1847969f318adf, same fixtures Exact copied source bytes verified before both production builds Pass
Story a11y-tokenizer-consecutive-selection direct-base-typeahead, direct-typeahead, inline-source-tokenizer, capped-cohort Exact requested story and one named combobox per frame Pass
Theme / mode neutral / light Rendered neutral theme and computed root color-scheme: light Pass
Direction LTR Computed subject direction ltr Pass
Viewport/media 1280×800, DPR 1; fine pointer/hover; no forced colors or reduced motion Exact match Pass
State Same typed query and focused input; only the fixed builds show its matching option “React” or “Alice” preserved; options 0→1; retained Bob option remains 1→1 Pass
Geometry Exactly one visible, non-zero combobox inside the viewport Match Pass
Settled render Loaded fonts; animations held; no visible error screen or page/console errors Match Pass
Image Non-blank 1280×800 PNGs Match; retained-selection before/after hashes identical Pass

Stack

Base stack/pr-6360-base is an unchanged snapshot of #6360 at c2e153fe18787750aaf8c7f7972cb6136a95671a. The feature branch has one additional fix commit; #6360 and its author's branch are untouched. Retarget/rebase onto main after the parent lands. Normal CI targets main, so it will not run against this temporary stack base.

Scope

  • One defect is restored.
  • Separable contradictory or unsettled tagalongs were removed or split.
  • No new public API, visual representation, default, or interaction model is hidden under the bug-fix label.
  • Public text and artifacts contain no internal Meta context.

Testing

  • pnpm lint:strict: passed.
  • pnpm build: passed.
  • pnpm -F @astryxdesign/core typecheck: passed.
  • Focused BaseTypeahead, Typeahead, and Tokenizer suites: 220 passed.
  • Exact-head Chromium interaction matrix: 11 passed, covering inline-source searches, direct typed selection, consecutive bootstrap selection, fallback, maximum, disabled transitions, and stale-work dismissal.
  • Full suite: 20,111 passed, 44 skipped, and 24 failures confined to four npm/package-boundary files on the Linux validation host. All four files were rerun unchanged on macOS: 69 passed, zero failed. Every initial failing test passed on rerun; no source/test changes or skipped suites were used to resolve these host-specific failures.

No physical assistive-technology session or cross-browser matrix was run. This fix does not alter layout, keyboard handling, or ARIA markup.

@vercel

vercel Bot commented Oct 23, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
astryx Building Building Preview Oct 23, 2026 10:41pm UTC

Request Review

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Oct 23, 2026
@astracat-bot

astracat-bot Bot commented Oct 23, 2026

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

Review status Updated
🔄 In progress (for maintainers only) Oct 23, 2026, 10:41 PM UTC

@imdreamrunner
imdreamrunner merged commit 21bef40 into stack/pr-6360-base Oct 23, 2026
2 of 3 checks passed
@github-actions
github-actions Bot deleted the fix/typeahead-pending-search-6360 branch October 24, 2026 06:20

This branch was successfully deployed

1 active deployment
Preview — 469b3413 Deployed Oct 23, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant