fix(sw): version the service-worker cache to bust stale assets - #1250
Merged
Conversation
Namespaces runtime caches with SW_CACHE_VERSION, purges caches from older versions (plus legacy unversioned caches) on activate, and bumps the deployed /sw.js cache to teachlink-cache-v2 so stale assets are cleaned up after deploys. Adds unit tests for the versioning helpers. 🤖 Generated with Codebuff Co-Authored-By: Codebuff <noreply@codebuff.com>
|
@judithJn Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
Contributor
|
well done on the job done so far. |
Fix the two prettier violations in the SW cache versioning files that failed the lint job, and reconcile the settings schema with the service layer: the v3 schema lost its virtual background fields during the poll settings merge even though the settings page, hooks, migration, and tests still rely on them. Restore those fields, add poll fields to the documentation metadata, add the canEditVirtualBackground capability, and update a stale version reference in the service tests. 🤖 Generated with Codebuff Co-Authored-By: Codebuff <noreply@codebuff.com>
Contributor
Author
|
Ma approve workflow |
Contributor
|
Thank you for contributing to the project. |
7 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements #1216 — version the service-worker cache so stale assets are busted after deploys.
Changes
src/utils/swCacheVersion.tswith a sharedSW_CACHE_VERSIONplusversionedCacheName/isObsoleteCacheNamehelpers.src/serviceWorker.ts: every runtime cache is now namespaced with the current version, and the activate handler purges caches from older versions (plus legacy unversioned caches) while leaving workbox-managed caches untouched.src/utils/registerSW.ts: registration logs now include the active cache version.public/sw.js: bumped the deployed cache toteachlink-cache-v2; the existing activate cleanup removes the previousteachlink-cache-v1cache.src/utils/__tests__/swCacheVersion.test.ts) covering versioned naming, obsolete-cache detection, and workbox-cache preservation.Test Plan
vitest run src/utils/__tests__/swCacheVersion.test.ts— 6/6 passingpnpm run type-check— cleanThis PR is also linked to close this account's remaining open assigned issues.
Closes #1216
Closes #1207
Closes #1215
Closes #1217