Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Learn About the Service Worker #48

Open
alexclst opened this issue Mar 2, 2019 · 1 comment
Open

Learn About the Service Worker #48

alexclst opened this issue Mar 2, 2019 · 1 comment
Labels
question Further information is requested

Comments

@alexclst
Copy link
Member

alexclst commented Mar 2, 2019

The web app uses a Service Worker to enable offline usage of the calculator. However, we’ve seen this result in a permanently white screen on load every now and then. Browsers, at least Safari, on both desktop and mobile give no way to kill off the Service Worker. There is no “hard reload” that loads fresh from the server, the only way a normal person could recover. But there aren’t even any dev tools to speak of that let us kill the Service Worker when it goes bad.

We have learned that a server-side workaround to kill the Service Worker is to temporarily put the following in service-worker.js:

// see https://blog.hackages.io/migrating-a-service-worker-from-an-old-domain-to-your-new-domain-69236418051c

self.addEventListener('install', () => self.skipWaiting());

self.addEventListener('activate', () => {
  self.registration.unregister();
});

But this isn’t a fix that any normal person can use. It is really a brute-force way to get unstuck for us developers, and not a fix at all.

So, the question is, do we remove the Service Worker entirely? The old calculator had used a different mechanism to enable offline use, which never died on us this badly. We may want to seriously consider switching to it for this calculator.

@alexclst alexclst added the question Further information is requested label Mar 2, 2019
@alexclst alexclst changed the title Reconsider the Service Worker Learn About the Service Worker Mar 2, 2019
@alexclst
Copy link
Member Author

alexclst commented Mar 2, 2019

Since the Service Worker is required on Android, and the recommended route on iOS, really we need to just make sure that we learn as much as we can about the Service Worker. Particularly, is there a better way to handle deployment that would alleviate this issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

1 participant