feat(#929): replace hardcoded mock data in header search with debounc… - #1111
Merged
RUKAYAT-CODER merged 1 commit intoJul 30, 2026
Merged
Conversation
…h debounced API query Replace executeSearch in useSearch.tsx with a debounced API call that uses AbortController to cancel in-flight requests on new keystrokes. Keep MOCK_DATA only as a dev fallback (when NEXT_PUBLIC_USE_MOCK_SEARCH=true or API unreachable). Changes:\n- New src/app/api/search/route.ts: Edge-runtime API endpoint with rate limiting, security headers, and scoring/live search\n- Updated src/app/hooks/useSearch.tsx: async executeSearch with AbortController, fetch abort-on-keystroke, mock fallback on failure\n- Updated src/app/hooks/__tests__/useSearch.test.tsx: mock globalThis.fetch instead of local mock data, drain microtasks for async assertions
|
@Topmatrixmor2014 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
Contributor
|
Thank you for contributing to the project. |
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.
…ed API query
Replace executeSearch in useSearch.tsx with a debounced API call that uses AbortController to cancel in-flight requests on new keystrokes. Keep MOCK_DATA only as a dev fallback (when NEXT_PUBLIC_USE_MOCK_SEARCH=true or API unreachable).
Changes:\n- New src/app/api/search/route.ts: Edge-runtime API endpoint with rate limiting, security headers, and scoring/live search\n- Updated src/app/hooks/useSearch.tsx: async executeSearch with AbortController, fetch abort-on-keystroke, mock fallback on failure\n- Updated src/app/hooks/tests/useSearch.test.tsx: mock globalThis.fetch instead of local mock data, drain microtasks for async assertions
Description
Brief description of changes
Related Issue
Closes #
Type of Change
Checklist
closes #929