fix(ratewise): 裁剪 PWA precache 修復行動冷啟動誤觸離線頁#502
Merged
Conversation
- precache 由 428 筆(約 34.5MB)降至 222 筆(約 11.8MB),排除幣別頁金額排列子頁 - 金額子頁改由 runtime html-cache 與 NavigationRoute 的 index.html SPA shell 還原 - 同步 offline.html 為 SSOT 模板產物(generate-offline-html.mjs 輸出) - 不改動 sw.ts 導覽邏輯 測試:typecheck 通過;pnpm test 全綠 2476+66;precache 222 筆 11.8MB 金額子頁洩漏 0 Generated with [Claude Code](https://claude.ai/code) via [Happy](https://happy.engineering) Co-Authored-By: Claude <noreply@anthropic.com> Co-Authored-By: Happy <yesreply@happy.engineering>
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
Contributor
Dependency Review✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.Scanned FilesNone |
Contributor
|
✅ SEO 審計通過!所有 2026 標準驗證項目都符合要求。
|
- Tier 1 precache 僅留 app shell(index.html)+ JS/CSS + 路由 loader 清單 + 4 shell 圖示 + offline.html - 7.3MB 圖片改 runtime CacheFirst(image-cache 60 筆/30 天);非 shell HTML 由 NavigationRoute 回退 app shell - 匯率 JSON 改 runtime SWR(GitHub raw + 同域 api/latest、api/pairs,7 天離線備援) - precache 由 222 筆/11.8MB 降至 92 筆/2.2MB;offline.html 僅作最後手段 - 保留 static-loader-data-manifest precache,離線 SPA 路由導覽不回歸 測試:typecheck 通過;PWA 相關 80 測試全綠;gate 92 筆/2.2MB 無洩漏;loader manifest 已 precache Generated with [Claude Code](https://claude.ai/code) via [Happy](https://happy.engineering) Co-Authored-By: Claude <noreply@anthropic.com> Co-Authored-By: Happy <yesreply@happy.engineering>
Contributor
|
✅ SEO 審計通過!所有 2026 標準驗證項目都符合要求。
|
- verifyAndRepairPrecache 補修 static-loader-data-manifest(離線 SPA 導覽唯一無 runtime 後備的 shell 資產) - latest-rate-cache maxEntries 20→32,預留擴充幣對餘裕避免 LRU 驅逐離線匯率備援 - 同域 API SWR matcher 加同源判斷,避免 cross-origin pathname 碰撞污染快取 - precache gate 新增 loader-manifest 必含檢查,FORBIDDEN 補 api JSON、巢狀 index.html、點陣圖 - 補回歸測試鎖定上述護欄(共 83 PWA 測試) 測試:typecheck 通過;PWA/gate 83 測試全綠;build precache 92 筆/2.2MB;hardened gate 通過 Generated with [Claude Code](https://claude.ai/code) via [Happy](https://happy.engineering) Co-Authored-By: Claude <noreply@anthropic.com> Co-Authored-By: Happy <yesreply@happy.engineering>
Contributor
|
✅ SEO 審計通過!所有 2026 標準驗證項目都符合要求。
|
This was referenced Jun 28, 2026
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.
問題
行動裝置(尤其 iOS PWA)冷啟動/弱網時,使用者會看到「您目前處於離線狀態」畫面(
offline.html,SW 導覽 fallback)。根因
vite.config.ts的injectManifest.globPatterns含**/*.html,SSG 產出每個幣別×金額排列頁(usd-twd/1、/10、/100、/1000…共數百頁)全部被 precache,導致:offline.html修法(KISS,2 行 globIgnore)
排除幣別頁金額排列子頁,僅保留 app shell(
index.html)與各幣別頂層 landing:金額子頁離線時改由
NavigationRoute→ precache 的index.htmlSPA shell client-render(行為不變,未改sw.ts),lazy route chunk 仍在 precache。offline.html/ landing / shell附帶:同步
offline.html為 SSOT 模板產物(generate-offline-html.mjs,原 committed 版本已 drift)。驗證
pnpm typecheck全 workspace 通過pnpm test全綠(ratewise 2476 + root Lighthouse regression 66)pnpm build:ratewise成功,precache 222 筆/11.8MiB、金額子頁洩漏 0(獨立重建確認)verify:artifacts通過後續(非本 PR;Lighthouse 回歸閘門已綠,屬增益非回歸)
motion/react仍 eager 於首頁多個核心元件(需跨元件動畫重構,UX 回歸面大,故不納入此 hotfix)🤖 Generated with Claude Code