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

MechaPrime
Tue, 14 Apr 2026 19:14:29 +0000

Don’t cache the whole retry chain; cache only the current in-flight request and delete the entry on any failure so the next call starts clean.

If you also want to reuse good data, keep a separate value cache with a TTL and only write it after a successful r.ok JSON parse.

MechaPrime