yeatmanlab / roar-dashboard

A dashboard to administer ROAR assessments
https://roar.education
Other
4 stars 4 forks source link

add service worker file and manually register service worker #694

Closed lucasxsong closed 3 months ago

lucasxsong commented 3 months ago

Proposed changes

Hopes to address 404 OAuth Error.

Updates the service worker file with a cleanupOutdatedCaches() function that should do as it is named. I've also updated the precacheAndRoute() function to account for a bug that was happening with the parameter previously passed in.

The PR also updates the VitePWA strategy from registerSW to injectManifest. This strategy makes the registration of the service worker more configurable and less dynamic. You can read more about the different strategies here. The change in strategy should fix an issue where the Sentry import was being injected into the previous, auto-generated service worker file.

I've tested on my local in development and production environments and the fixes seem to have taken care of a few of the bugs that I was seeing before. I can't say for certain it will fix the staging 404 error, but I think there is a fairly good chance it will take care of at least one of the bugs we are seeing right now. Feel free to take a look and review. Thanks!

Types of changes

What types of changes does this pull request introduce?

Checklist

Justification of missing checklist items

Further comments

github-actions[bot] commented 3 months ago

Visit the preview URL for this PR (updated for commit 9a9eb1b):

https://roar-staging--pr694-fix-service-worker-b997apqj.web.app

(expires Wed, 03 Jul 2024 21:11:31 GMT)

🔥 via Firebase Hosting GitHub Action 🌎

Sign: 2631e9c58fd0104ecbfddd72a62245ddac467460

cypress[bot] commented 3 months ago

Passing run #3057 ↗︎

0 26 0 0 Flakiness 0

Details:

Tests for PR 694 "add service worker file and manually register service worker" ...
Project: roar-dashboard-e2e Commit: 9a9eb1ba10
Status: Passed Duration: 03:37 💡
Started: Jun 26, 2024 9:09 PM Ended: Jun 26, 2024 9:13 PM

Review all test suite changes for PR #694 ↗︎