Skip to content

Commit

Permalink
fix(cloudflare): wait to cache until response complete (#3679)
Browse files Browse the repository at this point in the history
Co-authored-by: Wout Mertens <Wout.Mertens@gmail.com>
  • Loading branch information
manucorporat and wmertens committed Mar 4, 2024
1 parent 11aed89 commit 1995753
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/qwik-city/middleware/cloudflare-pages/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,9 @@ export function createQwikCity(opts: QwikCityCloudflarePagesOptions) {
// Store the fetched response as cacheKey
// Use waitUntil so you can return the response without blocking on
// writing to cache
ctx.waitUntil(cache.put(cacheKey, response.clone()));
ctx.waitUntil(
handledResponse.completion.then(() => cache.put(cacheKey, response.clone()))
);
}
return response;
}
Expand Down

0 comments on commit 1995753

Please sign in to comment.