Skip to content
This repository has been archived by the owner on Feb 3, 2020. It is now read-only.

Fix Unexpected token < error #6

Merged
merged 1 commit into from
Jul 30, 2018
Merged

Fix Unexpected token < error #6

merged 1 commit into from
Jul 30, 2018

Conversation

valgussev
Copy link

@valgussev valgussev commented Jul 28, 2018

By default skipWaiting parameter is set to true, allowing newly
registered service worker to bypass the waiting state, so all out of
date cache entries from the previous service worker will be deleted.

Because of async dynamic module loading we don't want that to happen,
keeping a way of loading old chunks.

The downside of removing skipWaiting is that newly deployed
service worker code and caches won't become active until all existing
tabs that have an older version of that service worker are closed, but
that actually sounds we want exactly this behaviour.

Related to
GoogleChromeLabs/sw-precache#180 (comment)

We can also provide users with a popup by click on which skipWaiting() will be called manually.

Any thoughts on this?

By default skipWaiting parameter is set to true, allowing newly
registered service worker to bypass the `waiting` state, so all out of
date cache entries from the previous service worker will be deleted.

Because of async dynamic module loading we don't want that to happen,
keeping a way of loading old chunks.

The downside of removing skipWaiting is that newly deployed
service worker code and caches won't become active until all existing
tabs that have an older version of that service worker are closed, but
that actually sounds we want exactly this behaviour.

Related to
GoogleChromeLabs/sw-precache#180 (comment)
Copy link

@evancharlton evancharlton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems reasonable to try it out.

@halvard-cognite
Copy link
Collaborator

You were not able to reproduce this and test locally?

@valgussev
Copy link
Author

I reproduced locally, but I believe it could be the wrong one.

  1. Create a new build yarn build
  2. Served it with firebase serve ensuring we use exactly the same environment as in production
  3. Opened the page, service worker has been installed and chunks have been cached
  4. Removed one of the chunks from Cache storage in dev tools
  5. Replaced build directory with another build from another brunch
  6. Tried to navigate to a new chunk section -> Received an error

If to set skipWaiting to false, the problem will never occur, since to install the new service worker we need to reopen tab.

@valgussev valgussev merged commit 56de531 into master Jul 30, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants