Repository navigation
fix(pwa): remove blocking install overlay, cache ffmpeg-core lazily - #8
Merged
Merged
Conversation
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>
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.
Summary
ffmpeg-core(~31 MB ESM, the dominant cost) out of the precache and into a runtimeCacheFirstroute. It's fetched on demand the first time a render path actually needs it (the existing lazygetFfmpeg()path), then cached for offline reuse.What changed
InstallProgressOverlaycomponent,useInstallProgresshook + tests, anduseFakeFfCounterhook + tests (only used by the overlay).<InstallProgressOverlay />mount points inApp.tsxand thevite-plugin-pwa/reacttype ref (no moreuseRegisterSWconsumer).vite.config.tsworkbox config:wasmfromglobPatterns, addsffmpeg-core/**toglobIgnores.maximumFileSizeToCacheInBytes(was 64 MiB to fit the core).runtimeCachingCacheFirstroute for/ffmpeg-core/*with 1-year expiration and cacheable status[0, 200].navigateFallbackDenylistfor/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 --noEmitcleannpm test— 580/580 passnpm run buildclean; inspected generateddist/sw.js:ffmpeg-core/*entriesregisterRoute(/^.*\/ffmpeg-core\/.*$/, new CacheFirst({ cacheName: "ffmpeg-core", ... }))present/ffmpeg-core/*requests show up in theffmpeg-corecache after they finish🤖 Generated with Claude Code