Sitelet https://github.com/angular/angular/commit/5be4edf
Skip to content

Commit 5be4edf

Browse files
sonukapoorjosephperrott
authored andcommitted
fix(service-worker): fix condition to check for a cache-busted request (#36847)
Previously, the condition to make the cache busted was executing although the network request was successful. However, this is not valid. The cache should only be marked as busted when the request failed. This commit fixes the invalid condition. PR Close #36847
1 parent 38d6596 commit 5be4edf

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

‎packages/service-worker/worker/src/assets.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -393,8 +393,8 @@ export abstract class AssetGroup {
393393
// reasons: either the non-cache-busted request failed (hopefully transiently) or if the
394394
// hash of the content retrieved does not match the canonical hash from the manifest. It's
395395
// only valid to access the content of the first response if the request was successful.
396-
let makeCacheBustedRequest: boolean = networkResult.ok;
397-
if (makeCacheBustedRequest) {
396+
let makeCacheBustedRequest: boolean = !networkResult.ok;
397+
if (networkResult.ok) {
398398
// The request was successful. A cache-busted request is only necessary if the hashes
399399
// don't match. Compare them, making sure to clone the response so it can be used later
400400
// if it proves to be valid.

0 commit comments

Comments
 (0)