Skip to content

feature: service worker#6876

Draft
bryan-robitaille wants to merge 43 commits into
mainfrom
feature/service_worker
Draft

feature: service worker#6876
bryan-robitaille wants to merge 43 commits into
mainfrom
feature/service_worker

Conversation

@bryan-robitaille

@bryan-robitaille bryan-robitaille commented Mar 23, 2026

Copy link
Copy Markdown
Contributor

Summary | Résumé

Adds a service worker that intercepts failed next action requests and forces the user to update their local version.
Screenshot 2026-05-25 at 10 56 22 AM

  • Form-builder retains state after full page reload so no changes that are out of sync with the server are lost
  • Form filler retains state after full page reload so no input responses are lost (file upload not yet compatible)

Test instructions | Instructions pour tester la modification

The PR review environment will trigger an update in the browser every 30 seconds.
By interacting with the application normally an update modal should be shown when an write action is taken (aka modifying a form or submitting a form response)

Unresolved questions / Out of scope | Questions non résolues ou hors sujet

  • File uploads are out of scope for now until SaveSession for saving responses locally can handle them.
  • Requires design to enhance user experience
  • Requires high level of QA testing.

Pull Request Checklist

Please complete the following items in the checklist before you request a review:

  • Have you completely tested the functionality of change introduced in this PR? Is the PR solving the problem it's meant to solve within the scope of the related issue?
  • The PR does not introduce any new issues such as failed tests, console warnings or new bugs.
  • If this PR adds a package have you ensured its licensed correctly and does not add additional security issues?
  • Is the code clean, readable and maintainable? Is it easy to understand and comprehend.
  • Does your code have adequate comprehensible comments? Do new functions have docstrings?
  • Have you modified the change log and updated any relevant documentation?
  • Is there adequate test coverage? Both unit tests and end-to-end tests where applicable?
  • If your PR is touching any UI is it accessible? Have you tested it with a screen reader? Have you tested it with automated testing tools such as axe?

@github-actions

Copy link
Copy Markdown
Contributor

@github-actions

Copy link
Copy Markdown
Contributor

@github-actions github-actions Bot added the !! Package Update !! Please ensure packages are built and pushed label May 20, 2026
@bryan-robitaille

Copy link
Copy Markdown
Contributor Author

@anikbrazeau

Copy link
Copy Markdown
Member

Potential content strings:

Form builder (v1)

EN

GC Forms has been updated.
Refresh your page to continue to the latest version of the application. Your latest changes will be saved. 

FR

Formulaires GC a eu une mise à jour.
Actualisez la page pour accéder à la dernière version de l'application. Vos dernières modifications seront enregistrées. 

Form filler (v1)

EN

This form has been updated. 
Go to the latest version. The answers you've entered will be saved.

FR

Ce formulaire a été mis à jour.
Passez à la nouvelle version. Vos réponses saisies seront conservées.

@timarney

timarney commented Jun 4, 2026

Copy link
Copy Markdown
Member

@samsadasivan what do you think about blurring out the "background"

I added code to dismiss toast messages when the App Updater pops but thinking there's really only one thing to do when it pops (reload). Having visible inline errors in the background isn't really helpful - you can't interact with them.

Screenshot 2026-06-04 at 3 02 52 PM

@timarney

timarney commented Jun 5, 2026

Copy link
Copy Markdown
Member

Helpful way to remove the service worker as need be

chrome://serviceworker-internals/

@timarney

timarney commented Jun 9, 2026

Copy link
Copy Markdown
Member

Updates styles

Screenshot 2026-06-09 at 7 45 16 AM

Comment thread public/service-worker.js
sw.addEventListener("fetch", (event) => {
const requestMethod = event.request.method;
const nextAction = Boolean(event.request.headers.get("next-action"));
fakeUpdateRequirement();

@timarney timarney Jun 10, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reminder to remove fakeUpdateRequirement();

Comment thread public/service-worker.js
}

// Here for testing purposes only, remove below before merging
function fakeUpdateRequirement() {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reminder to remove

Comment thread i18n/translations/en/common.json
Comment thread i18n/translations/fr/common.json
@anikbrazeau

Copy link
Copy Markdown
Member

FYI @bryan-robitaille new content strings are in :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

!! Package Update !! Please ensure packages are built and pushed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants