Fix service worker caching: correct file paths to resolve infinite spinner#780
Conversation
…rategy Co-authored-by: supervoidcoder <88671013+supervoidcoder@users.noreply.github.com>
Co-authored-by: supervoidcoder <88671013+supervoidcoder@users.noreply.github.com>
|
@copilot the network first was never the problem, it was the site never even loaded and stayed at the spinner splash screen forever. We still want network first so any updates to the site are reflected to everyone immediately if online. |
Co-authored-by: supervoidcoder <88671013+supervoidcoder@users.noreply.github.com>
You're absolutely right - I misunderstood the issue. The real problem was the incorrect file paths causing the service worker installation to fail (infinite spinner), not the caching strategy. I've restored the network-first strategy for JS files in commit e64021d. The fix now only corrects the file paths (removing incorrect What was fixed:
This should resolve the spinner issue while ensuring updates are reflected immediately when online. |
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
|
Important Review skippedBot user detected. To trigger a single review, invoke the You can disable this status message by setting the Use the checkbox below for a quick retry:
WalkthroughThe service worker cache infrastructure is updated by incrementing version identifiers (STATIC_CACHE v4→v5, DYNAMIC_CACHE v2→v3) and restructuring asset references to use root-level paths instead of static/ subdirectories, along with minor comments clarifying network-first behavior for JavaScript. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Possibly related PRs
Suggested labels
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Pull request overview
This PR fixes a critical service worker bug where incorrect static asset paths prevented the service worker from installing successfully, causing the application to hang at the splash screen spinner indefinitely. The root cause was that the service worker was attempting to cache files with a static/ prefix, but webpack copies files from the static/ source directory to the build root, so the actual deployed files don't have this prefix.
Changes:
- Corrected all static asset paths in service worker to match actual build output structure
- Bumped cache versions to force service worker reinstallation and cache invalidation
- Updated offline fallback HTML to use corrected image paths
🤖 Auto-Component Test Results🎉 No new UI components detected!This PR doesn't add any new buttons, menus, or clickable components. Triggered by Copilot • Commit |
🎉 MEGA PR Test & Analysis Complete!Hi @Copilot! Your PR has been fully tested and analyzed! 🚀✨ 🌍 Test DeploymentLive Preview: https://OmniBlocks.github.io/scratch-gui/Copilot/780/ 🧪 Test ResultsESLint: ✅ All checks passed! Unit Tests: ✅
Integration Tests: ❌
📄 Full test outputs available in artifacts 🔦 Performance Audit (Lighthouse)✅ Audit completed successfully! 📊 Lighthouse Scores:
⚡ Core Web Vitals:
🟢 90-100 (Good) | 🟠 50-89 (Needs Improvement) | 🔴 0-49 (Poor) 📄 Full report in artifacts 📦 Bundle Size AnalysisTotal Build Size: 172M 📦 Top 5 Largest JavaScript Files:
🎨 Top 5 Largest CSS Files:
♿ Accessibility Testing✅ Accessibility scan completed!
📊 Build Details
💡 Pro Tip: Only one build was needed for all these checks - saving CI/CD minutes! 🎯 |
🎬 ULTRA Visual Regression Test ResultsHi @Copilot! Tested across 9 combinations (3 platforms × 3 browsers). 8/9 completed. 📊 Test Matrix Summary
|
| Base | PR | Diff |
|---|---|---|
![]() | ![]() | ![]() |
Diff: 3.58% (32955 pixels)
Player View
✅ No pixel difference detected.
Extension Library
✅ No pixel difference detected.
Advanced Settings
✅ No pixel difference detected.
Ubuntu + WebKit
Editor Initial
✅ No pixel difference detected.
Blocks Workspace
✅ No pixel difference detected.
Stage Sprites
✅ No pixel difference detected.
Code Tab
✅ No pixel difference detected.
Costumes Tab
✅ No pixel difference detected.
Sounds Tab
✅ No pixel difference detected.
Songs Tab
| Base | PR | Diff |
|---|---|---|
![]() | ![]() | ![]() |
Diff: 1.79% (65823 pixels)
Player View
✅ No pixel difference detected.
Extension Library
| Base | PR | Diff |
|---|---|---|
![]() | ![]() | ![]() |
Diff: 38.43% (1416519 pixels)
Advanced Settings
✅ No pixel difference detected.
Windows + Chrome
Editor Initial
✅ No pixel difference detected.
Blocks Workspace
✅ No pixel difference detected.
Stage Sprites
✅ No pixel difference detected.
Code Tab
✅ No pixel difference detected.
Costumes Tab
✅ No pixel difference detected.
Sounds Tab
✅ No pixel difference detected.
Songs Tab
| Base | PR | Diff |
|---|---|---|
![]() | ![]() | ![]() |
Diff: 41.20% (379659 pixels)
Player View
✅ No pixel difference detected.
Extension Library
✅ No pixel difference detected.
Advanced Settings
✅ No pixel difference detected.
Windows + Firefox
Editor Initial
✅ No pixel difference detected.
Blocks Workspace
✅ No pixel difference detected.
Stage Sprites
✅ No pixel difference detected.
Code Tab
✅ No pixel difference detected.
Costumes Tab
✅ No pixel difference detected.
Sounds Tab
✅ No pixel difference detected.
Songs Tab
| Base | PR | Diff |
|---|---|---|
![]() | ![]() | ![]() |
Diff: 0.01% (105 pixels)
Player View
| Base | PR | Diff |
|---|---|---|
![]() | ![]() | ![]() |
Diff: 2.94% (48207 pixels)
Extension Library
✅ No pixel difference detected.
Advanced Settings
✅ No pixel difference detected.
Windows + WebKit
Editor Initial
✅ No pixel difference detected.
Blocks Workspace
✅ No pixel difference detected.
Stage Sprites
✅ No pixel difference detected.
Code Tab
✅ No pixel difference detected.
Costumes Tab
✅ No pixel difference detected.
Sounds Tab
✅ No pixel difference detected.
Songs Tab
| Base | PR | Diff |
|---|---|---|
![]() | ![]() | ![]() |
Diff: 0.41% (15145 pixels)
Player View
✅ No pixel difference detected.
Extension Library
✅ No pixel difference detected.
Advanced Settings
✅ No pixel difference detected.
Apple + Chrome
Editor Initial
✅ No pixel difference detected.
Blocks Workspace
✅ No pixel difference detected.
Stage Sprites
✅ No pixel difference detected.
Code Tab
✅ No pixel difference detected.
Costumes Tab
✅ No pixel difference detected.
Sounds Tab
✅ No pixel difference detected.
Songs Tab
✅ No pixel difference detected.
Player View
✅ No pixel difference detected.
Extension Library
| Base | PR | Diff |
|---|---|---|
![]() | ![]() | ![]() |
Diff: 0.28% (2538 pixels)
Advanced Settings
✅ No pixel difference detected.
Apple + Firefox
Editor Initial
✅ No pixel difference detected.
Blocks Workspace
| Base | PR | Diff |
|---|---|---|
![]() | ![]() | ![]() |
Diff: 0.21% (1094 pixels)
Stage Sprites
✅ No pixel difference detected.
Code Tab
| Base | PR | Diff |
|---|---|---|
![]() | ![]() | ![]() |
Diff: 0.12% (1094 pixels)
Costumes Tab
✅ No pixel difference detected.
Sounds Tab
✅ No pixel difference detected.
Songs Tab
| Base | PR | Diff |
|---|---|---|
![]() | ![]() | ![]() |
Diff: 0.01% (132 pixels)
Player View
| Base | PR | Diff |
|---|---|---|
![]() | ![]() | ![]() |
Diff: 2.86% (48190 pixels)
Extension Library
✅ No pixel difference detected.
Advanced Settings
✅ No pixel difference detected.
Apple + WebKit
Editor Initial
✅ No pixel difference detected.
Blocks Workspace
✅ No pixel difference detected.
Stage Sprites
✅ No pixel difference detected.
Code Tab
✅ No pixel difference detected.
Costumes Tab
✅ No pixel difference detected.
Sounds Tab
✅ No pixel difference detected.
Songs Tab
| Base | PR | Diff |
|---|---|---|
![]() | ![]() | ![]() |
Diff: 0.89% (32930 pixels)
Player View
| Base | PR | Diff |
|---|---|---|
![]() | ![]() | ![]() |
Diff: 2.94% (194492 pixels)
Extension Library
✅ No pixel difference detected.
Advanced Settings
✅ No pixel difference detected.
📦 Resources
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/playground/service-worker.js (1)
448-452:⚠️ Potential issue | 🟡 MinorPush notification paths still use the old
/static/prefix.The
iconandbadgepaths here were not updated as part of this PR, but they suffer from the same incorrectstatic/prefix that caused the caching failures fixed elsewhere. These should be corrected for consistency (and to work if push notifications are ever enabled).Proposed fix
const options = { body: 'Your project has been saved successfully!', - icon: '/static/images/192.png', - badge: '/static/favicon.ico', + icon: 'images/192.png', + badge: 'favicon.ico', tag: 'project-saved' };
🤖 Fix all issues with AI agents
In `@src/playground/service-worker.js`:
- Around line 261-264: The call to networkFirst(request) in the JS-handling
branch omits the cacheName, causing caches.open(cacheName) in networkFirst to
open a cache named "undefined" that isn't in the activation allow-list and gets
deleted; update the call to pass the intended cache constant (e.g., STATIC_CACHE
or DYNAMIC_CACHE) so JS responses are stored in a managed cache, i.e. change the
branch that currently returns networkFirst(request) to return
networkFirst(request, STATIC_CACHE) (or DYNAMIC_CACHE if you want them in the
runtime cache) so the cache name matches the activation allow-list used
elsewhere.
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
🤖 Auto-Component Test Results🎉 No new UI components detected!This PR doesn't add any new buttons, menus, or clickable components. Triggered by @supervoidcoder • Commit |
🎉 MEGA PR Test & Analysis Complete!Hi @Copilot! Your PR has been fully tested and analyzed! 🚀✨ 🌍 Test DeploymentLive Preview: https://OmniBlocks.github.io/scratch-gui/supervoidcoder/780/ 🧪 Test ResultsESLint: ✅ All checks passed! Unit Tests: ✅
Integration Tests: ❌
📄 Full test outputs available in artifacts 🔦 Performance Audit (Lighthouse)✅ Audit completed successfully! 📊 Lighthouse Scores:
⚡ Core Web Vitals:
🟢 90-100 (Good) | 🟠 50-89 (Needs Improvement) | 🔴 0-49 (Poor) 📄 Full report in artifacts 📦 Bundle Size AnalysisTotal Build Size: 172M 📦 Top 5 Largest JavaScript Files:
🎨 Top 5 Largest CSS Files:
♿ Accessibility Testing✅ Accessibility scan completed!
📊 Build Details
💡 Pro Tip: Only one build was needed for all these checks - saving CI/CD minutes! 🎯 |
🎬 ULTRA Visual Regression Test ResultsHi @Copilot! Tested across 9 combinations (3 platforms × 3 browsers). 8/9 completed. 📊 Test Matrix Summary
|
| Base | PR | Diff |
|---|---|---|
![]() | ![]() | ![]() |
Diff: 3.91% (35999 pixels)
Player View
✅ No pixel difference detected.
Extension Library
✅ No pixel difference detected.
Advanced Settings
✅ No pixel difference detected.
Ubuntu + WebKit
Editor Initial
✅ No pixel difference detected.
Blocks Workspace
✅ No pixel difference detected.
Stage Sprites
✅ No pixel difference detected.
Code Tab
✅ No pixel difference detected.
Costumes Tab
✅ No pixel difference detected.
Sounds Tab
✅ No pixel difference detected.
Songs Tab
| Base | PR | Diff |
|---|---|---|
![]() | ![]() | ![]() |
Diff: 0.46% (17084 pixels)
Player View
✅ No pixel difference detected.
Extension Library
| Base | PR | Diff |
|---|---|---|
![]() | ![]() | ![]() |
Diff: 38.43% (1416519 pixels)
Advanced Settings
✅ No pixel difference detected.
Windows + Chrome
Editor Initial
✅ No pixel difference detected.
Blocks Workspace
✅ No pixel difference detected.
Stage Sprites
✅ No pixel difference detected.
Code Tab
✅ No pixel difference detected.
Costumes Tab
✅ No pixel difference detected.
Sounds Tab
✅ No pixel difference detected.
Songs Tab
| Base | PR | Diff |
|---|---|---|
![]() | ![]() | ![]() |
Diff: 41.48% (382304 pixels)
Player View
✅ No pixel difference detected.
Extension Library
✅ No pixel difference detected.
Advanced Settings
✅ No pixel difference detected.
Windows + Firefox
Editor Initial
✅ No pixel difference detected.
Blocks Workspace
✅ No pixel difference detected.
Stage Sprites
✅ No pixel difference detected.
Code Tab
✅ No pixel difference detected.
Costumes Tab
✅ No pixel difference detected.
Sounds Tab
✅ No pixel difference detected.
Songs Tab
| Base | PR | Diff |
|---|---|---|
![]() | ![]() | ![]() |
Diff: 22.56% (207876 pixels)
Player View
| Base | PR | Diff |
|---|---|---|
![]() | ![]() | ![]() |
Diff: 0.00% (15 pixels)
Extension Library
✅ No pixel difference detected.
Advanced Settings
✅ No pixel difference detected.
Windows + WebKit
Editor Initial
✅ No pixel difference detected.
Blocks Workspace
✅ No pixel difference detected.
Stage Sprites
✅ No pixel difference detected.
Code Tab
✅ No pixel difference detected.
Costumes Tab
✅ No pixel difference detected.
Sounds Tab
✅ No pixel difference detected.
Songs Tab
| Base | PR | Diff |
|---|---|---|
![]() | ![]() | ![]() |
Diff: 0.11% (3997 pixels)
Player View
✅ No pixel difference detected.
Extension Library
✅ No pixel difference detected.
Advanced Settings
✅ No pixel difference detected.
Apple + Chrome
Editor Initial
✅ No pixel difference detected.
Blocks Workspace
✅ No pixel difference detected.
Stage Sprites
✅ No pixel difference detected.
Code Tab
✅ No pixel difference detected.
Costumes Tab
✅ No pixel difference detected.
Sounds Tab
✅ No pixel difference detected.
Songs Tab
✅ No pixel difference detected.
Player View
✅ No pixel difference detected.
Extension Library
| Base | PR | Diff |
|---|---|---|
![]() | ![]() | ![]() |
Diff: 0.28% (2538 pixels)
Advanced Settings
✅ No pixel difference detected.
Apple + Firefox
Editor Initial
✅ No pixel difference detected.
Blocks Workspace
✅ No pixel difference detected.
Stage Sprites
✅ No pixel difference detected.
Code Tab
✅ No pixel difference detected.
Costumes Tab
✅ No pixel difference detected.
Sounds Tab
✅ No pixel difference detected.
Songs Tab
| Base | PR | Diff |
|---|---|---|
![]() | ![]() | ![]() |
Diff: 0.22% (2028 pixels)
Player View
| Base | PR | Diff |
|---|---|---|
![]() | ![]() | ![]() |
Diff: 2.86% (48190 pixels)
Extension Library
✅ No pixel difference detected.
Advanced Settings
✅ No pixel difference detected.
Apple + WebKit
Editor Initial
✅ No pixel difference detected.
Blocks Workspace
✅ No pixel difference detected.
Stage Sprites
✅ No pixel difference detected.
Code Tab
✅ No pixel difference detected.
Costumes Tab
✅ No pixel difference detected.
Sounds Tab
✅ No pixel difference detected.
Songs Tab
| Base | PR | Diff |
|---|---|---|
![]() | ![]() | ![]() |
Diff: 0.29% (10554 pixels)
Player View
✅ No pixel difference detected.
Extension Library
✅ No pixel difference detected.
Advanced Settings
✅ No pixel difference detected.











































































Service worker installation was failing due to incorrect static asset paths, causing the site to stay at the spinner splash screen forever.
Changes
Corrected static asset paths
static/prefix from root-level files (samples, beepbox, manifest, favicon)static/nintaribox_samples.js→nintaribox_samples.jsnow match actual build structureimages/,player/)Caching strategy
Maintained network-first strategy for JavaScript files to ensure site updates are reflected immediately when online:
JS files use network-first for immediate updates, while other static assets (images, fonts, etc.) use cache-first for performance.
Cache invalidation
STATIC_CACHEv4→v5 andDYNAMIC_CACHEv2→v3 to force reinstallResult
Service worker now installs successfully with correct file paths, resolving the infinite spinner issue and enabling proper offline PWA functionality while ensuring updates are reflected immediately when online.
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.