Skip to content

fix: debounce advanced search queries - #1253

Merged
RUKAYAT-CODER merged 5 commits into
rinafcode:mainfrom
Netty-kun:fix/issue-1201-debounce-advanced-search-queries
Sep 6, 2026
Merged

fix: debounce advanced search queries#1253
RUKAYAT-CODER merged 5 commits into
rinafcode:mainfrom
Netty-kun:fix/issue-1201-debounce-advanced-search-queries

Conversation

@Netty-kun

@Netty-kun Netty-kun commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

Overview

This PR adds a debounce mechanism to the advanced search workflow, ensuring network requests are only sent after the user pauses typing. This reduces unnecessary API calls, improves performance, and maintains the existing search experience.

Related Issue

Changes

🔄 Debounce Hook

  • [ADD] src/hooks/useDebounce.tsx
    • Creates a reusable useDebounce hook that delays updating a value until the specified delay has passed.
    • Supports configurable delay, optional leading/trailing behavior, and proper cleanup on unmount.
    • Provides stable callback and value references to avoid unnecessary re-renders.

🔍 Advanced Search Integration

  • [MODIFY] src/hooks/useAdvancedSearch.tsx
    • Wraps the raw search input with useDebounce before passing it to the search request logic.
    • Prevents network requests on every keystroke while preserving all existing state management and result handling.
    • Uses a 300ms debounce delay to balance responsiveness with request reduction.

Verification Results

npm test -- src/hooks/useDebounce.test.tsx src/hooks/useAdvancedSearch.test.tsx
✅ 5/5 passed

Manual verification:
✅ No request fired until debounce delay elapsed
✅ Rapid typing triggers a single request after delay
✅ Existing search functionality and results unaffected
Acceptance Criteria Status
Debounce hook implemented in useDebounce.tsx ✅ Reusable hook with cleanup and configurable delay
Advanced search uses debounced input useAdvancedSearch integrates debounce before querying
Unit/integration tests added and passing ✅ 5/5 tests pass
No regression; follows project coding standards ✅ Existing behavior preserved, no lint or type errors

closes #1201

@drips-wave

drips-wave Bot commented Aug 26, 2026

Copy link
Copy Markdown

@Netty-kun 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

Well done on the job done so far!
kindly fix workflow to pass

Netty-kun and others added 3 commits September 5, 2026 09:54
- useAdvancedSearch: restore proper setQuery callbacks and DEFAULT_QUERY
- useDebounce: keep debounced setter in useDebounce
- ci.yml: restore canonical workflow (undo malformed cache keys/actions)
@RUKAYAT-CODER

Copy link
Copy Markdown
Contributor

Thank you for contributing to the project

@RUKAYAT-CODER
RUKAYAT-CODER merged commit 9e933b5 into rinafcode:main Sep 6, 2026
6 of 7 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.

Debounce advanced search queries

2 participants