Conversation
🏷️ Automatic Labeling SummaryThis PR has been automatically labeled based on the files changed and PR metadata. Applied Labels: size-xs Label Categories
For more information, see |
🔍 Lighthouse Performance Audit
📥 Download full Lighthouse report Budget Compliance: Performance budgets enforced via |
Agent-Logs-Url: https://github.com/Hack23/riksdagsmonitor/sessions/23c83ee8-e3ae-408b-a915-2205b09d82aa Co-authored-by: pethers <1726836+pethers@users.noreply.github.com>
🔍 Lighthouse Performance Audit
📥 Download full Lighthouse report Budget Compliance: Performance budgets enforced via |
🔍 Lighthouse Performance Audit
📥 Download full Lighthouse report Budget Compliance: Performance budgets enforced via |
There was a problem hiding this comment.
Pull request overview
Adds first-class PWA offline support by introducing a repository-managed service worker and wiring it into the browser entrypoint, with targeted caching for CIA datasets and basic shell assets.
Changes:
- Added a Workbox-free service worker (
public/sw.js) with separate caches for static shell assets and CIA data (SWR). - Registered the service worker from
src/browser/main.ts(deferred towindow.load) and updated ESLint globals for the SW context. - Added unit tests for the service worker behavior (VM sandbox) and a Cypress assertion for Service Worker API availability.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| tests/service-worker.test.ts | Adds Vitest coverage for install/activate/fetch handlers and caching helpers using a VM sandbox + fake CacheStorage. |
| src/browser/main.ts | Registers /sw.js on load to enable PWA/offline behavior. |
| public/sw.js | Implements caching strategies (SWR for CIA data, cache-first for documents/styles, passthrough for other requests). |
| eslint.config.js | Adds serviceworker globals for public/sw.js to avoid no-undef on SW globals. |
| cypress/e2e/homepage.cy.js | Adds an E2E assertion that navigator.serviceWorker is present. |
| FUTURE_ARCHITECTURE.md | Documents the implemented service worker approach and cache names. |
| const cached = await caches.match(request); | ||
| if (cached) return cached; | ||
|
|
||
| const response = await fetch(request); | ||
| if (response && response.ok) { | ||
| const cache = await caches.open(cacheName); |
|
@copilot apply changes based on the comments in this thread |
Agent-Logs-Url: https://github.com/Hack23/riksdagsmonitor/sessions/046e1332-587c-4a56-b62b-da60d6c0d75d Co-authored-by: pethers <1726836+pethers@users.noreply.github.com>
Fixed in 73ff3f0: |
🔍 Lighthouse Performance Audit
📥 Download full Lighthouse report Budget Compliance: Performance budgets enforced via |
public/sw.js) with SWR for CIA data + cache-first for HTML/CSSsrc/browser/main.tstests/service-worker.test.ts(10 specs, all passing)cypress/e2e/homepage.cy.jsserviceworkerenv blockFUTURE_ARCHITECTURE.mdPWA section updatedcacheFirstnow opens the named cache and reads only from it (was usingcaches.matchwhich searches all caches, undermining cache versioning); added regression test verifying isolation betweenriksdagsmonitor-v1andcia-data-v1