Skip to content

Restore reliable offline embed navigation - #113

Merged
scaryrawr merged 1 commit into
mainfrom
copilot/fix-offline-mode
Aug 10, 2026
Merged

Restore reliable offline embed navigation#113
scaryrawr merged 1 commit into
mainfrom
copilot/fix-offline-mode

Conversation

Copilot AI commented Aug 7, 2026

Copy link
Copy Markdown

The embed page could fail when offline or when its extensionless route returned an HTTP error, despite the shell being cached.

  • Service worker

    • Serve cached embed.html for known embed routes when network responses are unsuccessful.
    • Preserve network errors for unknown routes.
  • Regression coverage

    • Cover extensionless embed-route 404 fallback.
    • Verify the embed shell and WASM animation load offline.
  • Tooling

    • Use canonical embed.html URLs for offline screenshots.

Co-authored-by: scaryrawr <661373+scaryrawr@users.noreply.github.com>
@scaryrawr
scaryrawr marked this pull request as ready for review August 7, 2026 19:12
Copilot AI lite review requested due to automatic review settings August 7, 2026 19:12

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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/embed returning 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.html route.
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' });
@scaryrawr
scaryrawr merged commit 92ab37d into main Aug 10, 2026
11 checks passed
@scaryrawr
scaryrawr deleted the copilot/fix-offline-mode branch August 10, 2026 17:35
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.

3 participants