Frontmatter
| id | 8690 |
| title | Optimize ServiceWorker Update Transition |
| state | Closed |
| labels | enhancementaiperformancecore |
| assignees | tobiu |
| createdAt | Jan 15, 2026, 2:08 PM |
| updatedAt | Jan 15, 2026, 2:19 PM |
| githubUrl | https://github.com/neomjs/neo/issues/8690 |
| author | tobiu |
| commentsCount | 1 |
| parentIssue | null |
| subIssues | [] |
| subIssuesCompleted | 0 |
| subIssuesTotal | 0 |
| blockedBy | [] |
| blocking | [] |
| closedAt | Jan 15, 2026, 2:19 PM |
Optimize ServiceWorker Update Transition

tobiu
Jan 15, 2026, 2:19 PM
Input from Gemini 3 Pro:
✦ I have optimized the ServiceWorker update transition to prevent blocking page loads.
Changes Implemented:
- Lazy Cache Cleanup: The
onActivatehandler now triggerscleanUpCaches()asynchronously without awaiting it insideevent.waitUntil(). This ensures the Service Worker activates and claims clients immediately.- Dedicated Cleanup Method: Added
cleanUpCaches()toServiceBase.mjsto handle the iteration and deletion of old versioned caches.- Verification of Versioning: Confirmed that
ServiceBaserelies onthis.cacheName(which appendsthis.version) to isolate caches per version (e.g.,neo-runtime-11.21.0).Impact:
- Faster Updates: The new Service Worker will take control of the page almost instantly after installation.
- No Blocking: The deletion of old caches (which can be slow) happens in the background, allowing network requests for the new version to proceed immediately.
- Blank Page Fix: This should resolve the reported issue where users saw a blank page while the SW was busy deleting old files.
The changes have been pushed to
dev.
tobiu assigned to @tobiu on Jan 15, 2026, 2:19 PM
tobiu closed this issue on Jan 15, 2026, 2:19 PM
Users report blank pages during Neo.mjs version updates. The investigation reveals that the current implementation of
onActivateperforms synchronous, blocking cache deletion insideevent.waitUntil(). This prevents the browser from handlingfetchevents until all old caches are deleted, leading to perceived hang times or blank pages.Changes:
onActivateto performclients.claim()immediately and resolvewaitUntil.cleanUpCachesmethod.cleanUpCachesasynchronously (fire-and-forget) after activation, ensuring the UI thread is not blocked during the update.