Repository navigation
fix(pwa): disable navigation preload and serve cached static app shell on handoff - #79
Merged
Merged
Conversation
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.
变更说明
public/sw.js升级激活阶段显式禁用浏览器导航预加载(navigationPreload.disable())并移除preloadResponse,修复 iOS WebKit 在 Wi-Fi 切换蜂窝网络时底层预加载请求挂在失效连接上无法被AbortController中止、进而通过 HTTP/2 连接复用堵住后续同源探活请求的问题。sw.js,在线访问时缓存纯静态首页壳与带哈希的/assets/*脚本样式字体,切网握手超时或断网时直接秒开应用主界面壳,同时严格保持/api/*只走网络不写入缓存,登录重定向时自动驱逐本地首页壳缓存。App.tsx与report-building.ts为首次断网读取增加联网事件触发与 3 秒自动恢复探测,网络恢复后一并刷新归档与同步状态查询,重新登录前清理本地前端壳缓存并预留完整认证超时窗口。0.16.7版本。验证结果
bun run test全量 85 个测试文件 628 项测试通过。tests/pwa.browser.ts真实 Chromium 离线回退静态界面壳、冷缓存离线兜底页与联网自动恢复验收通过。bun run build、bunx prettier --check与git diff --check通过。