Skip to content

Commit

Permalink
I keep having the same error so I added this
Browse files Browse the repository at this point in the history
if (event.request.cache === 'only-if-cached' && event.request.mode !== 'same-origin')
return
And all errors are gone :-) meanbee/magento-meanbee-pwa#20 (comment)
  • Loading branch information
englishextra committed Sep 29, 2020
1 parent 8d9a355 commit c3da167
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,14 @@ self.addEventListener("fetch", function (event) {
};

event.waitUntil(updateCache(event.request));

/*!
* https://github.com/meanbee/magento-meanbee-pwa/issues/20#issuecomment-497626347
*/

if (event.request.cache === "only-if-cached" && event.request.mode !== "same-origin") {
return;
}

event.respondWith(
fetch(event.request).catch (function (error) {
Expand Down
9 changes: 9 additions & 0 deletions sw.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,15 @@ self.addEventListener("fetch", function(event) {
};

event.waitUntil(updateCache(event.request));

/*!
* https://github.com/meanbee/magento-meanbee-pwa/issues/20#issuecomment-497626347
*/

if (event.request.cache === "only-if-cached" && event.request.mode !== "same-origin") {
return;
}

event.respondWith(
fetch(event.request).catch(function(error) {
console.log(
Expand Down
3 changes: 1 addition & 2 deletions sw.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit c3da167

Please sign in to comment.