Skip to content

Improve search stability: debounce input and cancel in-flight GitHub requests#338

Open
ABHImaybeJEET wants to merge 4 commits into
GitMetricsLab:mainfrom
ABHImaybeJEET:single-commit/debounce
Open

Improve search stability: debounce input and cancel in-flight GitHub requests#338
ABHImaybeJEET wants to merge 4 commits into
GitMetricsLab:mainfrom
ABHImaybeJEET:single-commit/debounce

Conversation

@ABHImaybeJEET
Copy link
Copy Markdown

THIS PR CLOSES #337 .

Description

  • Debounces search fetches to reduce redundant API calls and UI flicker.
  • Cancels previous in-flight requests using AbortController so only the latest result updates the UI.
  • Wires AbortSignal into Octokit requests (request: { signal }).
  • Adds cleanup on unmount to clear timers and abort pending requests.
  • Removed a strict minimum-query-length guard per request to avoid overly aggressive filtering.

Changes

  • Modified useGitHubData.ts:
    • Added a 350ms debounce around fetchData.
    • Added AbortController cancellation for previous requests.
    • Passed signal into octokit.request calls for both issues and commits endpoints.
    • Added cleanup effect to clear debounce timers and abort controllers on unmount.
    • Removed MIN_QUERY_LENGTH guard (now fetches are only gated by presence of octokit).

Why

  • Prevents multiple overlapping API requests when typing rapidly.
  • Reduces GitHub API consumption and the likelihood of hitting rate limits.
  • Avoids stale/out-of-order responses updating the UI.
  • Improves responsiveness and UX on slower networks.

Testing

  • Manual: type different GitHub usernames rapidly in the tracker UI and confirm:
    • Only one request is active after typing stops (350ms).
    • UI updates correspond to the latest query.
    • No flicker from out-of-order responses.
  • Optional: adjust debounce timeout (DEBOUNCE_MS) if you prefer shorter/longer delay.

@netlify
Copy link
Copy Markdown

netlify Bot commented May 19, 2026

Deploy Preview for github-spy ready!

Name Link
🔨 Latest commit 3b33d5c
🔍 Latest deploy log https://app.netlify.com/projects/github-spy/deploys/6a0cb5fbf360e50008da5219
😎 Deploy Preview https://deploy-preview-338--github-spy.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 19, 2026

Warning

Rate limit exceeded

@ABHImaybeJEET has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 49 minutes and 36 seconds before requesting another review.

You’ve run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 340a54cc-ccba-4307-9376-9d9944706b63

📥 Commits

Reviewing files that changed from the base of the PR and between 8d17610 and 3b33d5c.

📒 Files selected for processing (3)
  • src/hooks/useGitHubData.ts
  • src/pages/Tracker/Tracker.tsx
  • src/utils/commitClassifier.ts
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Improve Search Request Handling to Prevent Excessive GitHub API Calls During Rapid Input

1 participant