Skip to content

Throttle + debounce#2458

Open
ManishMadan2882 wants to merge 3 commits intoarc53:mainfrom
ManishMadan2882:main
Open

Throttle + debounce#2458
ManishMadan2882 wants to merge 3 commits intoarc53:mainfrom
ManishMadan2882:main

Conversation

@ManishMadan2882
Copy link
Copy Markdown
Collaborator

  • What kind of change does this PR introduce? (Bug fix, feature, docs update, ...)
    migrated the fetch direct calls in the frontend to use the apiClient, then added a throttledApiClient

    • apiClient (default export) --> raw fetch, no concurrency control, no dedupe.
    • throttledApiClient (named export) --> fetch wrapped by withThrottle(...) from api/throttle.ts, i.e. global cap (8), per-route cap (3), and in-flight GET deduplication.

    Defaults for the throttle middleware (maxConcurrentGlobal=8, maxConcurrentPerRoute=3, dedupe=true for GET) are configurable via withThrottle(...) in api/client.ts if they need tuning later.
    Dedupe is intentionally GET-only and keyed by method + pathname; mutating verbs are never coalesced.
    Aborting a request removes it from the per-route queue and rejects with a standard AbortError, matching native fetch semantics - existing callers that rely on AbortController continue to work unchanged.

    added the useDebouncedValue and useDebouncedCallback hooks
    useDebouncedValue - debounces a value. You give it state, it gives you a delayed copy of that state.
    useDebouncedCallback - debounces a function call. give it a function, it gives you a wrapped version that delays its invocation.

  • Why was this change needed? (You can also link to an open issue here)
    Add throttling to frontend api calls #162

  • Other information:

@vercel
Copy link
Copy Markdown

vercel Bot commented May 8, 2026

@ManishMadan2882 is attempting to deploy a commit to the Arc53 Team on Vercel.

A member of the Team first needs to authorize it.

@codecov
Copy link
Copy Markdown

codecov Bot commented May 8, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.16%. Comparing base (9b8fe2d) to head (0bcc2be).
⚠️ Report is 27 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2458      +/-   ##
==========================================
- Coverage   91.34%   91.16%   -0.19%     
==========================================
  Files         248      255       +7     
  Lines       20709    21675     +966     
==========================================
+ Hits        18916    19759     +843     
- Misses       1793     1916     +123     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@vercel
Copy link
Copy Markdown

vercel Bot commented May 8, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
oss-docsgpt Ready Ready Preview, Comment May 8, 2026 0:12am

Request Review

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant