Restore reliable offline embed navigation - #113
Merged
Conversation
Co-authored-by: scaryrawr <661373+scaryrawr@users.noreply.github.com>
Copilot created this pull request from a session on behalf of
scaryrawr
August 7, 2026 19:12
View session
scaryrawr
marked this pull request as ready for review
August 7, 2026 19:12
There was a problem hiding this comment.
Pull request overview
This pull request improves offline reliability for the SL web embed by making the service worker serve a cached embed.html shell when extensionless embed navigations return HTTP errors, and adds regression tests to ensure the embed continues to load and run offline.
Changes:
- Service worker now falls back to the cached canonical shell (
embed.html) for known navigation routes when the network returns an HTTP error. - Adds a unit regression test for
/sl/embedreturning 404 and an end-to-end Playwright test verifying the embed runs offline (including WASM-driven animation). - Updates the screenshot script to use the canonical
embed.htmlroute.
Show a summary per file
| File | Description |
|---|---|
| apps/page/take-screenshots.mjs | Switches offline embed screenshot navigation to embed.html. |
| apps/page/src/service-worker.ts | Adds cached-shell fallback behavior for unsuccessful navigation responses. |
| apps/page/src/service-worker.test.ts | Adds regression coverage for extensionless embed 404 fallback behavior. |
| apps/page/playwright/offline.e2e.js | Adds offline embed runtime verification (shell + animation content). |
Review details
- Files reviewed: 4/4 changed files
- Comments generated: 2
- Review effort level: Lite
Comment on lines
179
to
+186
| fetch(request) | ||
| .then((response) => { | ||
| if (!response.ok) { | ||
| return response; | ||
| const navigationCachePath = getNavigationCachePath(BASE_PATH, url.pathname); | ||
| if (!navigationCachePath) { | ||
| return response; | ||
| } | ||
|
|
| // Also take offline embed screenshot | ||
| const embedPage = await context.newPage(); | ||
| await embedPage.goto(`${baseURL}/sl/embed?train=D1&loop=true`, { waitUntil: 'domcontentloaded' }); | ||
| await embedPage.goto(`${baseURL}/sl/embed.html?train=D1&loop=true`, { waitUntil: 'domcontentloaded' }); |
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.
The embed page could fail when offline or when its extensionless route returned an HTTP error, despite the shell being cached.
Service worker
embed.htmlfor known embed routes when network responses are unsuccessful.Regression coverage
Tooling
embed.htmlURLs for offline screenshots.