While working on #2983935: serviceworkers.js - Response not cacheable I came across something in the install event listener which I found curious. Originally the code would install even when the list of assets couldn't be cached.

I personally think it should err on the side of caution and avoid signaling successful installation unless everything gets cached. This is the general behavior expected when the very commonly-used cache.addAll() method is used. We're not using it in order to handle potential third-party requests such as Google Fonts and the like.

However if we fail to cache stuff, the PWA (and the module) fails at one of its basic missions: offline support. Since this is the primary feature we advertise on the module's page, I have a hunch that people will find half-installations unsatisfying. I also feel like site admins would rather field support requests for the PWA not installing, rather than fielding requests for offline support that only entails black-on-white HTML files that lack styles.

For now I am filing this issue and doing the conservative thing: to comment out this line of code and fail the installation unless everything in the pre-cache arrays is successfully cached:

  • CACHE_URLS
  • CACHE_URLS_ASSETS
  • CACHE_OFFLINE
  • CACHE_OFFLINE_IMAGE

Is there anybody out there evaluating this module that has an opinion?

Comments

rupl created an issue. See original summary.

  • rupl committed bdf63a0 on 7.x-1.x
    Create issue #2986596: Should PWA installation fail when pre-caching is...
mustanggb’s picture

I think it's fine to fail if pre-caching is unsuccessful, as it points a developer that something needs sorting.

---

On a possibly unrelated note, just thinking out load a bit, if #3032124: delivery callback not found and #3032128: Handle menu status codes in pwa_deliver_js_file() make it in it might be useful to do something with status codes.

nod_’s picture

Version: 7.x-1.x-dev » 7.x-2.x-dev
Status: Active » Fixed

now it's dealt with by workbox, so their default is our default seems to do the job.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.