Conversation
|
比如服务器短暂返回 500 之后网络中断,离线时会把缓存的 500 页面返回给用户; 建议加个 // networkFirst
const response = await fetch(request);
if (response.ok) {
cache.put(request, response.clone());
}
return response;
// staleWhileRevalidate
.then((response) => {
if (response.ok) {
cache.put(request, response.clone());
}
return response;
}) |
已处理,感谢指出。 这边修了两处:
同时补充了对应测试用例,覆盖上述两个场景。 |
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
Code Review:feat(webui): add pwa support (#1688)变更概述本 PR 为 WebUI 添加 PWA 支持,包含:manifest、PWA 图标、service worker( 方案评估结论:✅ 方案合理 方案采用原生 Service Worker API 而非重型框架(如 Workbox),对于本场景是合适的轻量选择。 问题清单🟡 MEDIUM —
|
| # | 严重级别 | 文件 | 问题 |
|---|---|---|---|
| 1 | 🟡 MEDIUM | src/renderer/services/registerPwa.ts |
覆盖率约 58%,低于 80% 目标,缺少 isPwaRegistrationSupported 的多条防御分支及 catch 路径测试 |
结论
registerPwa.ts 的缺失测试分支(约需 3–4 个用例)后可合并。
本报告由本地 pr-review skill 生成,包含完整项目上下文,无截断限制。
- Add test for missing serviceWorker in navigator - Add test for non-http protocol (file: scheme) - Add test for insecure non-localhost origin - Add test for service worker registration failure (catch path) Review follow-up for iOfficeAI#1688
PR Fix 验证报告原始 PR: #1688
总结: ✅ 已修复 1 个 | ❌ 未能修复 0 个
|
Summary
Add PWA support to the WebUI for mobile installability and basic offline capability
Add
manifest.webmanifest, PWA icons, service worker registration, and manifest metadata in the WebUI rendererAdd tests covering service worker registration and PWA-related build output
Test plan
manifest.webmanifestbun run testNotes
PWA installability requires a secure context:
https://for remote/mobile accesshttp://localhostfor local development onlyhttp://<public-ip>:<port>will not enable full PWA behavior in Android Chrome