Throttle + debounce#2458
Open
ManishMadan2882 wants to merge 3 commits intoarc53:mainfrom
Open
Conversation
|
@ManishMadan2882 is attempting to deploy a commit to the Arc53 Team on Vercel. A member of the Team first needs to authorize it. |
Codecov Report✅ All modified and coverable lines are covered by tests. 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. 🚀 New features to boost your workflow:
|
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
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.
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
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: