2 min read
Coalesce duplicate requests
const inflight = new Map();
function dedupe(key, fn) {
if (inflight.has(key)) return inflight.get(key);
const promise = fn().finally(() => inflight.delete(key));
inflight.set(key, promise);
return promise;
}
// two components asking for products share one call
dedupe('products', () => fetch(`${BASE}/products`).then(r => r.json()));
Debounce and cache
Debounce the quote calls so a slider fires once per pause, and cache the catalogue so multiple widgets on a page share one fetch. Together these keep even a heavy page comfortably under the limit.
Frequently asked questions
Can one page trip the rate limit?
A naive widget with a live slider can. Debounce writes, cache reads and coalesce duplicate in-flight requests and you will stay well within the limit.
What is request coalescing?
When two parts of the page ask for the same data at once, you make one request and share the promise, rather than firing two identical calls.
Related reading

Quickstart: handle rate limits on the public API
The public ring is rate-limited, and a 429 tells you exactly when to try again. Read the RateLimit-Remaining…
Read →
Quickstart: Build a live repayment illustration
A live illustration that quotes as the user moves a slider feels great — debounce it so you respect the rate…
Read →
Quickstart: Cache the product catalogue correctly
The catalogue changes rarely, so caching it removes the API from your hot path and keeps you well under the…
Read →
Quickstart: add timeouts and retries to a Node.js API client
A production API client needs a timeout and a retry policy. In Node, an AbortController bounds every request…
Read →Funding for UK limited companies
Credicorp lends to your company, not to you personally — short-term working capital with no personal guarantee. See what your business could access.