Skip to content

Commit

Permalink
fix(offline-interface): prevent infinite update loop in Chrome (#638)
Browse files Browse the repository at this point in the history
  • Loading branch information
KaiVandivier committed Sep 7, 2021
1 parent c42ccc6 commit 079f6ea
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion pwa/src/offline-interface/offline-interface.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,16 @@ export class OfflineInterface {
}

if ('serviceWorker' in navigator) {
navigator.serviceWorker.oncontrollerchange = () =>
let reloading
navigator.serviceWorker.oncontrollerchange = () => {
if (reloading) {
// Fixes an infinite update loop when 'Update on reload' is
// checked in Chrome
return
}
reloading = true
window.location.reload()
}
}
}
/**
Expand Down

0 comments on commit 079f6ea

Please sign in to comment.