Repository navigation
fix(pwa): hand Chrome the current manifest on the first launch after an upgrade - #165
Conversation
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository: devswha/herdr-web-ui/.coderabbit.yaml Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (2)
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 5 remain after this review. 📝 SummarySummary by CodeRabbit
WalkthroughThe manifest link now includes ChangesAndroid manifest cache update
Priority: ⬇️ Low Estimated code review effort: 1 (Trivial) | ~5 minutes Change: Bug fix · Severity of issue fixed: Low Suggested reviewers: Merge Risk: ⚪ Minimal · up to The manifest URL change addresses the identified stale-cache path, and no merge-blocking issue remains after normal checks. Architecture SummaryArchitecture risk: 🔵 Low · up to The change affects 2 systems. Changed systems: Architecture concerns Review detailsSystems and components
Before / after behavior
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
## Change Installed apps are on v0.3.32. Prepare v0.3.33: bump the app and plugin versions together and move the Unreleased notes into the dated release section. This release includes: - the chat finding an omo pane's conversation through the holder records current omo publishes (#162) - the installed Android app getting the 0.3.32 auto-rotate fix a day sooner: the first launch after an upgrade no longer hands Chrome the old cached manifest (#165) ## Validation - `releaseNotes("0.3.33", …)` passes (package.json, herdr-plugin.toml and a single CHANGELOG heading agree). - The required Fast checks and Integration and browser checks must pass before squash merge. Publish through release.yml after merge; it validates the release commit again before creating the tag.
Change
Follow-up to #159. Reports kept coming after v0.3.32 that the installed Android app still rotates with auto-rotate locked.
Cause. A service worker from 0.3.31 or older serves
/manifest.webmanifestcache-first. On the first launch after the server upgrades, that old worker still controls the page, so the document's manifest is the cached one withorientation: "any". The document keeps that manifest after the new worker activates. Chrome's WebAPK update check (WebApkUpdateManager, at most once per 24 h per launch) compares against this stale manifest, finds no change, and records the check. The rotation fix then waits at least another day, plus Chrome's charging + unmetered requirement for the re-mint.index.html: the manifest link is/manifest.webmanifest?v=2. No old worker has that URL cached, so its cache-first path misses and fetches the current manifest from the network. The server serves it by pathname (no-cache,application/manifest+json). The installed app keeps its identity:webapk_update_data_fetcher.ccaccepts a new manifest URL when the manifestid(/) matches.Existing 0.3.32 installs that already launched once are unaffected by this change and update on the next daily check. Reinstalling applies the fix at once.
Validation
sw.jsand manifest, then switched the server to the current files and relaunched.Page.getAppManifeston the first launch after upgrade:orientation: "any"with the plain link (no network request for the manifest), none with?v=2(manifest fetched from the network). The second launch has no orientation in both cases.bun run build:dist/index.htmllinks/manifest.webmanifest?v=2.GET /manifest.webmanifest?v=2answers 200,application/manifest+json,Cache-Control: no-cache, noorientation.HERDR_TEST_MODE=unit bun test ./src/pwa.test.ts: 2 pass.