diff --git a/packages/service-worker/worker/src/data.ts b/packages/service-worker/worker/src/data.ts index 85e797c91c..3b476111c9 100644 --- a/packages/service-worker/worker/src/data.ts +++ b/packages/service-worker/worker/src/data.ts @@ -354,10 +354,11 @@ export class DataGroup { // Cache the network response eventually. ctx.waitUntil(this.safeCacheResponse(req, networkFetch)); + } else { + // The request completed in time, so cache it inline with the response flow. + await this.cacheResponse(req, res, lru); } - // The request completed in time, so cache it inline with the response flow. - await this.cacheResponse(req, res, lru); return res; }