Code Explainers

Code explainers tagged #request-deduplication

javascript
import { useState, useEffect, useCallback, useRef } from 'react';
 
const cache = new Map();
const inflight = new Map();

Building a stale-while-revalidate hook in React

caching request-deduplication custom-hooks
Advanced 10 steps
typescript
import {
  CallHandler,
  ExecutionContext,
  Injectable,

Deduping in-flight requests in NestJS

interceptor request-deduplication rxjs
Advanced 6 steps
javascript
const cache = new Map();
const inflight = new Map();
 
async function fetchResults(query) {

Building a typeahead with an LRU cache

caching lru-eviction request-deduplication
Intermediate 9 steps