Skip to content

feat(#929): replace hardcoded mock data in header search with debounc… - #1111

Merged
RUKAYAT-CODER merged 1 commit into
rinafcode:mainfrom
Topmatrixmor2014:issue-929-debounced-api-search
Jul 30, 2026
Merged

feat(#929): replace hardcoded mock data in header search with debounc…#1111
RUKAYAT-CODER merged 1 commit into
rinafcode:mainfrom
Topmatrixmor2014:issue-929-debounced-api-search

Conversation

@Topmatrixmor2014

Copy link
Copy Markdown

…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

  • Bug fix
  • New feature
  • Breaking change
  • Documentation update

Checklist

  • Code follows project style guidelines
  • Self-review completed
  • No console errors
  • Uses Lucide icons consistently
  • Responsive design implemented
  • Starknet best practices followed

closes #929

…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
@drips-wave

drips-wave Bot commented Jul 30, 2026

Copy link
Copy Markdown

@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! 🚀

Learn more about application limits

@RUKAYAT-CODER

Copy link
Copy Markdown
Contributor

Thank you for contributing to the project.

@RUKAYAT-CODER
RUKAYAT-CODER merged commit 4856539 into rinafcode:main Jul 30, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Replace hardcoded mock data in header search with a debounced API query

3 participants