feat(milestones): debounced search with request cancellation and state machine (#1102) - #1146
Open
Simultech369 wants to merge 4 commits into
Open
Simultech369 wants to merge 4 commits into
Simultech369 wants to merge 4 commits into
Conversation
… advisories in dependency audit
…and restore standard ci test runner
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.
Closes #1102
Description
This PR implements accessible, debounced search for the Milestones board with in-flight request cancellation, out-of-order race condition guards, and distinct loading/empty/error states.
Key Changes
src/hooks/useDebouncedMilestonesSearch.ts):AbortControllercancellation for superseded requests when new search begins or query is cleared.requestIdRef) guaranteeing that out-of-order responses (fast-then-slow) are cleanly dropped and only the newest result wins.idle,loading,success,empty, anderrorwith structured typed errors (MilestonesSearchError).retry()for instantaneous retry without debounce delay, andclear()for zero-latency reset.src/lib/searchMilestones.ts):src/components/milestones/MilestoneSearchBar.tsx):role="searchbox"andaria-label="Search milestones".aria-live="polite"region announcing search state, matching counts, and empty states to screen readers.✕) and spinner indicator during async queries.src/app/milestones/page.tsx):docs/milestones-debounced-search.md):Test Coverage & Edge Cases
src/lib/__tests__/searchMilestones.test.ts): 10 tests verifying normalization, case insensitivity, multi-field matching, AbortSignal immediate and delayed cancellation, and structured error instances.src/hooks/__tests__/useDebouncedMilestonesSearch.test.ts): 5 comprehensive tests with Jest fake timers covering:src/app/milestones/__tests__/milestones-search.integration.test.tsx): 7 end-to-end tests validating searchbox rendering, debounced filtering, empty state with action button, inline clear button, Escape key, filter combination, and error retry banner.Verification
npm test: 26/26 search-related tests pass; all existing milestone tests pass.npm run lint: 0 errors, 0 warnings.npm run build: Turbopack Next.js production build passes cleanly.