Skip to content

Fix service worker: IndexedDB, caching strategy, precache list - #1

Open
Lspnjr1 wants to merge 1 commit into
mainfrom
fix/service-worker-bugs
Open

Fix service worker: IndexedDB, caching strategy, precache list#1
Lspnjr1 wants to merge 1 commit into
mainfrom
fix/service-worker-bugs

Conversation

@Lspnjr1

@Lspnjr1 Lspnjr1 commented Jul 18, 2026

Copy link
Copy Markdown
Owner

Summary

  • Replace localStorage with IndexedDB (localStorage throws in SW scope)
  • Implement network-first for HTML, stale-while-revalidate for assets
  • Add skipWaiting()/clients.claim() for immediate SW activation
  • Update precache list with all required app files
  • Remove references to non-existent icon assets

Test plan

  • Verify background sync analytics works without errors in console
  • Deploy a change to game.js and confirm returning users receive the update
  • Test full offline flow: login → game after first visit with network disabled
  • Confirm no 404 errors for icon assets in push notifications

Fixes DogStark#3

…aching, complete precache list

- Replace localStorage with IndexedDB (localStorage unavailable in SW scope)
- Implement network-first for HTML, stale-while-revalidate for assets
- Add skipWaiting/clients.claim for immediate SW activation
- Update precache list with login.html, game.html, auth-manager.js, ai-agent.js, minipay-integration.js
- Use Promise.allSettled to prevent single cache failure from breaking all caching
- Remove references to non-existent icon assets in push notifications

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

🐛 Service worker is broken: localStorage in SW scope throws, cache-first serves stale app forever, precache list incomplete

1 participant