fix(ratewise): 強化 SW 離線 JS/CSS 三層回退並收斂回退 SSOT#452
Merged
Conversation
- setCatchHandler 的 JS/CSS 回退補回 exact→ignoreSearch→matchPrecache 三層 - 抽出 resolveOfflineStaticResourceFallback 與文件回退 matcher 為單一來源 - converterStore persist 與 storage-keys 改引用 CONVERTER_STORE_KEY 常數 - 清理過時與重複註解,未更動既有對外契約 測試:ratewise typecheck 通過、SW 與 PWA 相關 205 測試通過
Contributor
Dependency Review✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.Scanned FilesNone |
Contributor
|
✅ SEO 審計通過!所有 2026 標準驗證項目都符合要求。
|
This was referenced Jun 27, 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.
摘要
網路失敗時,Service Worker 對 JS/CSS 資源原本只做單層
caches.match(req)比對,cache 驅逐後易出現「Load failed」。本 PR 補回文檔化的三層回退(exact → ignoreSearch → matchPrecache),並把離線回退邏輯收斂為單一來源。背景 / 證據
變更
sw.ts:JS/CSS catch handler 改用resolveOfflineStaticResourceFallback(三層);文件回退 matcher 抽為OFFLINE_DOCUMENT_FALLBACK_MATCHERS單一來源;移除過時/重複註解。pwaOfflineFallback.ts:新增resolveOfflineStaticResourceFallback()+getPrecacheLookupKeys()SSOT。storage-keys.ts/converterStore.ts:persist key 改引用CONVERTER_STORE_KEY常數,去除硬編碼'ratewise-converter'。影響範圍 / 注意
sw.ts與chore/ratewise-production-governance-v2既有 SW 工作可能重疊,merge 前請確認不衝突。驗收
pnpm --filter @app/ratewise typecheck✅🤖 Generated with Claude Code