Decouple service worker from manifest through a dedicated "service worker submodule"

Created on 21 September 2023, about 1 year ago
Updated 22 September 2023, about 1 year ago

Problem/Motivation

Currently, the manifest functionality can NOT be used without the service worker being activated. The service worker itself only provides the offline functionality of the app and isn't a core feature of a PWA. It also isn't one of the 'install criterias' for a PWA (anymore): https://web.dev/install-criteria/#criteria (Atleast for chrome).
And at last, there are currently quite a few problems with the service worker implementation inside this module (see 🐛 [META][pwa_service_worker] Refactor 'pwa_service_worker' implementations and flaws Needs work ).

Steps to reproduce

Proposed resolution

Decouple service worker from manifest through a dedicated "service worker submodule"

Remaining tasks

User interface changes

API changes

Data model changes

📌 Task
Status

Fixed

Version

2.0

Component

Code

Created by

🇩🇪Germany Grevil

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @Grevil
  • Open in Jenkins → Open on Drupal.org →
    Core: 10.0.7 + Environment: PHP 8.1 & MySQL 8
    last update about 1 year ago
    1 pass, 2 fail
  • @grevil opened merge request.
  • Status changed to Needs review about 1 year ago
  • 🇩🇪Germany Grevil

    Alright, this should be all done now. After running "drush updb" I still get an apparent manifest.json schema error, but after clearing all cashes it's not there anymore.

    Should we find the right caches to clear on update hook? Or let the user run it himself?
    Furthermore, we still need to clear the old service worker inside our update hook.

    But this can be reviewed already. 🙂

  • Open in Jenkins → Open on Drupal.org →
    Core: 10.0.7 + Environment: PHP 8.1 & MySQL 8
    last update about 1 year ago
    11 pass
  • Status changed to RTBC about 1 year ago
  • 🇩🇪Germany Anybody Porta Westfalica

    Thanks @Grevil, this wasn't a simple task, but looks really really good!

    Due to the many changes I wasn't able to compare every single line, but I trust you made the changes very carefully and took the time to test everything. Once you're sure it' fine, let's merge this one in and make some final tests with the dev version.

    Afterwards, let's release 2.1.0-alpha1

  • 🇩🇪Germany Anybody Porta Westfalica
  • Open in Jenkins → Open on Drupal.org →
    Core: 10.0.7 + Environment: PHP 8.1 & MySQL 8
    last update about 1 year ago
    11 pass
  • Status changed to Needs work about 1 year ago
  • 🇩🇪Germany Grevil

    Ok, I understood the service worker cache version now, pretty smart!

    // When Drupal replaces `cacheVersion` during server-side processing, it includes
    // the packaged version number. That means any module upgrade will automatically
    // result in a fresh SW installation.

    So basically the cache version of the service worker is generated by the integer set in the configuration + the "version" from the info.yml. Meaning the old service worker will discard itself on update!! :)

    We should also manually reset the cache version config to 1 on every update! So the admins can up them manually and don't have to start from their old cache version!

    Now we only need to clear the correct caches for the manifest.

  • Open in Jenkins → Open on Drupal.org →
    Core: 10.0.7 + Environment: PHP 8.1 & MySQL 8
    last update about 1 year ago
    11 pass
  • Issue was unassigned.
  • Status changed to Needs review about 1 year ago
  • 🇩🇪Germany Grevil

    Alright, all done. As internally discussed with @Anybody, we'll simply flush all caches on update, since it would take too long, to pin point the correct caches to clear here. Final review pls! :)

  • Open in Jenkins → Open on Drupal.org →
    Core: 10.0.7 + Environment: PHP 8.1 & MySQL 8
    last update about 1 year ago
    11 pass
  • Status changed to RTBC about 1 year ago
  • 🇩🇪Germany Anybody Porta Westfalica
  • Open in Jenkins → Open on Drupal.org →
    Core: 10.0.7 + Environment: PHP 8.1 & MySQL 8
    last update about 1 year ago
    11 pass
  • Status changed to Fixed about 1 year ago
  • 🇩🇪Germany Anybody Porta Westfalica

    MERGED! Great!

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

Production build 0.71.5 2024