Skip to content

Fix service worker onUpdate not triggering if page load was interrupted - #23

Open
TheRusskiy wants to merge 1 commit into
cra-template:mainfrom
TheRusskiy:master
Open

Fix service worker onUpdate not triggering if page load was interrupted#23
TheRusskiy wants to merge 1 commit into
cra-template:mainfrom
TheRusskiy:master

Conversation

@TheRusskiy

Copy link
Copy Markdown

We need to handle the case when a page is loaded and a service worker is already "waiting".

To me this happens randomly when you least expect, but one way to reproduce this issue is to open the page,
see that service worker is beginning to download and close / reload the page.

It seems that Chrome finishes the SW load even if you close the page. In this case on the next page load it's waiting and not installing, which means the
registration.waiting.postMessage({ type: "SKIP_WAITING" }) trick won't work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants