Fix service worker installation failure on Firefox#7755
Fix service worker installation failure on Firefox#7755pranjalisr wants to merge 21 commits intowebpack:mainfrom
Conversation
|
@pranjalisr is attempting to deploy a commit to the OpenJS Foundation Team on Vercel. A member of the Team first needs to authorize it. |
|
@alexander-akait Just following up to kindly request a review of this PR when you have availability. |
|
@evenstensberg Can you look at this and test, I think we can merge it |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Tested in Firefox using production build (yarn build + yarn serve-dist). Service worker installs successfully and no longer aborts on install.
@evenstensberg Can you please check this? If this sounds Ok then I will push the code changes. |
ovflowd
left a comment
There was a problem hiding this comment.
Appreciate the contribution. Code is not ideal, made a few suggestions :)
src/sw.js
Outdated
| return url.href; | ||
| }); | ||
|
|
||
| const allManifestURLs = [...manifest, ...otherManifest].map( |
There was a problem hiding this comment.
doubt it is a problem but lets filter out so we dont have duplicate urls before we access the cache
There was a problem hiding this comment.
What do you suggest? Should I make changes in allManifestURLs ?
There was a problem hiding this comment.
yes just filter out dupes, easy to do if you convert it to a set and back to an array.
There was a problem hiding this comment.
Made code changes as suggested. Checked locally, working fine on firefox browser.


Summary
Fixes #7738
Fix SW install failure in Firefox by replacing cache.addAll() with Promise.allSettled() to prevent installation from failing due to individual precache errors. Also deduplicates manifest URLs before caching.
What kind of change does this PR introduce?
Code change
Did you add tests for your changes?
No.
Does this PR introduce a breaking change?
No.
If relevant, what needs to be documented once your changes are merged or what have you already documented?
No documentation changes are required.