8000 fix(pwa): remove blocking install overlay, cache ffmpeg-core lazily by johannboehme · Pull Request #8 · johannboehme/tk-1 · GitHub
[go: up one dir, main page]

Skip to content

fix(pwa): remove blocking install overlay, cache ffmpeg-core lazily - #8

Merged
johannboehme merged 1 commit into
mainfrom
claude/zealous-boyd-f2eeb6
May 1, 2026
Merged

johannboehme merged 1 commit into
mainfrom
claude/zealous-boyd-f2eeb6

Conversation

@johannboehme
Copy link
Copy Markdown
Owner

Summary

  • The first-install overlay was gating the entire app behind a ~62 MB precache download. That's a hostile first-contact pattern for a public web app, and unnecessary — pre-PWA the app loaded fine without any precache at all.
  • Moves ffmpeg-core (~31 MB ESM, the dominant cost) out of the precache and into a runtime CacheFirst route. It's fetched on demand the first time a render path actually needs it (the existing lazy getFfmpeg() path), then cached for offline reuse.
  • App shell stays precached so reload speed is unchanged. Precache shrinks from 60+ MB to 1338 KiB / 30 entries.

What changed

  • Removed InstallProgressOverlay component, useInstallProgress hook + tests, and useFakeFfCounter hook + tests (only used by the overlay).
  • Removed all three <InstallProgressOverlay /> mount points in App.tsx and the vite-plugin-pwa/react type ref (no more useRegisterSW consumer).
  • Reshaped vite.config.ts workbox config:
    • Drops wasm from globPatterns, adds ffmpeg-core/** to globIgnores.
    • Drops maximumFileSizeToCacheInBytes (was 64 MiB to fit the core).
    • Adds runtimeCaching CacheFirst route for /ffmpeg-core/* with 1-year expiration and cacheable status [0, 200].
    • Keeps navigateFallbackDenylist for /ffmpeg-core/ so the SPA fallback never intercepts core fetches.

Tradeoff

A user who installs the PWA and immediately goes offline before ever rendering won't have ffmpeg-core cached. Acceptable — nobody installs a video editor in order to use it offline 30 s later.

Test plan

  • tsc --noEmit clean
  • npm test — 580/580 pass
  • npm run build clean; inspected generated dist/sw.js:
    • precache list contains app shell only, no ffmpeg-core/* entries
    • registerRoute(/^.*\/ffmpeg-core\/.*$/, new CacheFirst({ cacheName: "ffmpeg-core", ... })) present
  • Manual: first visit lands directly on the app (no overlay), DevTools › Application › Service Workers shows SW activating in the background
  • Manual: trigger a render, confirm /ffmpeg-core/* requests show up in the ffmpeg-core cache after they finish
  • Manual: hard reload while offline after one render works (app shell + ffmpeg-core both from cache)

🤖 Generated with Claude Code

The first-install overlay gated the entire app behind a ~62 MB
precache download — terrible first contact for a public web app and
unnecessary, since pre-PWA the app loaded fine without any precache
at all.

Switch ffmpeg-core (~31 MB ESM, the dominant cost) from precache to
runtime CacheFirst caching: it's fetched on demand the first time a
render path actually needs it, then cached for offline reuse. The
app shell stays precached (~1.3 MB, 30 entries) so reload is fast.

Tradeoff: a user who installs and immediately goes offline before
ever rendering won't have ffmpeg cached. Acceptable — nobody installs
a video editor to start it offline 30 s later.

Removes:
- InstallProgressOverlay component + 3 mount points in App.tsx
- useInstallProgress hook + tests
- useFakeFfCounter hook + tests (only used by the overlay)
- vite-plugin-pwa/react type ref (the useRegisterSW hook is no
  longer imported)

Reshapes vite.config.ts workbox config:
- Drops `wasm` from globPatterns and adds `ffmpeg-core/**` to
  globIgnores so the ESM/UMD core never enters the precache list.
- Drops `maximumFileSizeToCacheInBytes` (was 64 MiB to fit the core).
- Adds runtimeCaching CacheFirst route for `/ffmpeg-core/*` with
  1-year expiration.
- Keeps navigateFallbackDenylist for `/ffmpeg-core/` so the SPA
  fallback never intercepts core fetches.

Build verified: precache shrunk from 30+ entries / 60+ MB to 30
entries / 1338 KiB; sw.js contains the new CacheFirst route.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@johannboehme
johannboehme merged commit 03c4d1f into main May 1, 2026
1 check passed
@johannboehme
johannboehme deleted the claude/zealous-boyd-f2eeb6 branch May 1, 2026 20:06
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.

1 participant

0