Created by: ro-savage
This is an attempt to address issue #2554 (closed) SWI3. Issues with service worker cache invalidation.
It also addresses SWI1 & SWI2 by auto reloading updated/different pages without user interaction.
To avoid confusion to the user, while the page is checking if the service worker is changed / exists, it displays a blank page.
Using the technique we damage a few of the advantages of PWA in return for 'easy of use' for developers and end users.
-
By default with PWA/SW, we can load the page instantly with the old/cached content. Using this technique, we must wait for a response from the server before showing the page. (Still works offline)
-
If we we find the page has changed, we do a force reload which means we've already hit the server once and waited for a response, and we then have to do the whole thing over again. If we'd just not used service workers we would have loaded the page faster.
This is just a POC. It is not a solid way to solve issues due to the issues above. Hopefully it might inspire some other ideas about how we could invalidate SWs and alternative ways to update the app without asking the user to refresh.