Service Worker Fallback#1417
Merged
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR hardens the frontend service worker lifecycle to reduce “stale cache” breakages, improve offline navigation fallback, and make update activation safer across multiple tabs.
Changes:
- Refactors
sw.jsprecache to be atomic, followdynamicImportstransitively, avoid caching raw.html, and add guarded cache purging + narrow runtime caching. - Adjusts update flow so only the tab that clicked “Update Now” auto-reloads on
controllerchange; other tabs get a prompt. - Updates MapLibre sprite URL parsing to handle URL-normalized sprite URLs; bumps
maplibre-glto 5.24.0.
Reviewed changes
Copilot reviewed 8 out of 9 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| api/web/src/test/sw.spec.ts | Expands SW unit tests for install atomicity, entry-path HTML mapping, activate guard behavior, runtime caching, and offline navigation fallback. |
| api/web/src/stores/modules/icons.ts | Updates sprite protocol regex to support MapLibre URL normalization and @2x variants. |
| api/web/src/main.ts | Replaces “wipe all caches/unregister SW” recovery with targeted cache eviction + SW update check, guarded per tab-session. |
| api/web/src/base/service-worker.ts | Adds per-tab “update requested” flag; uses updateViaCache: 'none'; changes controllerchange behavior to avoid reloading other tabs. |
| api/web/src/App.vue | Marks the current tab as the update initiator before posting SKIP_WAITING. |
| api/web/public/sw.js | Implements manifest traversal with dynamicImports, entry-shell mapping, atomic precache, guarded old-cache purge, narrow runtime caching, and offline navigation fallback. |
| api/web/package.json | Bumps maplibre-gl from 5.23.0 to 5.24.0. |
| api/web/package-lock.json | Updates lockfile for the maplibre-gl bump (and transitive deps) and package version. |
| api/lib/limits.ts | Raises LimitAll maximum from 100 to 1000 (but description currently still states 100). |
Files not reviewed (1)
- api/web/package-lock.json: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
No description provided.