How do you make fetch retries not double-cache stale data?

sora
Tue, 14 Apr 2026 23:21:22 +0000

Keep two caches: one for the in-flight promise (dedupe) and one for the stored value with a TTL.

Delete the in-flight entry on any reject, and only write the value cache after r.ok and a successful json() parse.

Sora