[SOLVED] Chrome (but not FF nor Safari) randomly fails PWA update
-
I am cautiously optimistic that moving my fetch and update dialog and reload code to the
updatefound
hook has fixed it! But I still need more testing -
I really think moving it to
updatefound
fixes it!!! -
Sounds promising! The code/flow stays the same if using
updatefound
instead ofupdated
? -
yes everything else is the same. Since the service worker itself is updating the code regardless of what I am doing (updating local version string and clearing localstorage) I can do what I need earlier in the process and reload which works great! So happy to have found this solution it was really a vexing problem (that only showed up in Chrome for some reason)
-
Hope this ‘workaround’ won’t be trashed in the next Chrome update
-
UGH, I REALLY hate to have to revisit this, but wouldn’t you know it, this fix made all the OTHER browsers break! I ended up having to do this in the end, which really sucks:
updatefound (registration) { // registration -> a ServiceWorkerRegistration instance console.log('New content is downloading.') /* eslint-disable no-extra-boolean-cast */ if (!!window.chrome) { // all my checking and clearing localstorage stuff here for stupid chrome browsers (Chrome, Edge, etc) } }, updated (registration) { // registration -> a ServiceWorkerRegistration instance console.log('New content is available; please refresh.') if (!window.chrome) { // all my checking and clearing localstorage stuff here for non chrome browsers (FF, Safari) } } },
-
-
@dobbel no they were not very helpful at all, other than to say they didn’t know: https://github.com/GoogleChrome/workbox/issues/2652
-
Here’s someone that unregisters the service worker before reload:
-
@dobbel thanks I took a look, but for now my workaround seems to be working so I think I will leave it. Still, this is good info and I might try it later, thanks for the heads up!
-
I’ve suddenly started to get this after upgrading Quasar to latest - wondered if anyone had come up with a reliable solution since the last post ?
Operating System - Windows_NT(10.0.19041) - win32/x64 NodeJs - 12.16.1 Global packages NPM - 3.10.6 yarn - 1.22.4 @quasar/cli - 1.1.3 @quasar/icongenie - Not installed cordova - Not installed Important local packages quasar - 1.15.10 -- Build high-performance VueJS user interfaces (SPA, PWA, SSR, Mobile and Desktop) in record time @quasar/app - 2.2.4 -- Quasar Framework local CLI @quasar/extras - 1.10.2 -- Quasar Framework fonts, icons and animations eslint-plugin-quasar - Not installed vue - 2.6.12 -- Reactive, component-oriented view layer for modern web interfaces. vue-router - 3.2.0 -- Official router for Vue.js 2 vuex - 3.6.0 -- state management for Vue.js electron - Not installed electron-packager - Not installed electron-builder - Not installed @babel/core - 7.13.8 -- Babel compiler core. webpack - 4.44.2 -- Packs CommonJs/AMD modules for the browser. Allows to split your codebase into multiple bundles, which can be loaded on demand. Support l stuff. webpack-dev-server - 3.11.0 -- Serves a webpack app. Updates the browser on changes. workbox-webpack-plugin - 6.1.2 -- A plugin for your Webpack build process, helping you generate a manifest of local files that workbox-sw should precache. register-service-worker - 1.7.1 -- Script for registering service worker, with hooks typescript - 4.2.2 -- TypeScript is a language for application scale JavaScript development @capacitor/core - Not installed @capacitor/cli - Not installed @capacitor/android - Not installed @capacitor/ios - Not installed Quasar App Extensions @quasar/quasar-app-extension-dotenv - 1.1.0 -- Load .env variables into your quasar project ```
-
I would ask this on the new forum where the Quasar team now gives support.