farmOS / field-kit

A modular, offline-first companion app to farmOS.
https://farmOS.org
GNU General Public License v3.0
62 stars 39 forks source link

PWA Feature: offer a page reload when app updates #362

Closed jgaehring closed 4 years ago

jgaehring commented 4 years ago

Details here on how this can be done with Workbox:

https://developers.google.com/web/tools/workbox/guides/advanced-recipes#offer_a_page_reload_for_users

We're using the workbox Webpack plugin; not sure the same thing can be achieved with that, but we can explore options.

jgaehring commented 4 years ago

Interesting comment I found in this demo:

        // At this point, registration has taken place.
        // The service worker will not handle requests until this page and any
        // other instances of this page (in other tabs, etc.) have been
        // closed/reloaded.

I wonder if this is why some people had trouble getting the app to update, if they had it open in another tab somewhere. Hmm... :thinking:

jgaehring commented 4 years ago

Took a first pass at this with b6c8ad9 and it's working pretty well! Next step is to replace the window.confirm() with a custom banner.