zdl
|
9de4e10637
|
fix(service-worker): 修复 fetch 事件处理器的 Response 转换错误
修复了 Service Worker 的 fetch 事件处理器中 `caches.match()` 可能返回
undefined 导致的 "Failed to convert value to 'Response'" 错误。
## 问题
- 当网络请求失败且缓存中没有匹配资源时,`caches.match()` 返回 undefined
- `event.respondWith()` 必须接收 Response 对象,不能接收 undefined
- 导致浏览器控制台报错: TypeError: Failed to convert value to 'Response'
## 修复内容
- 添加请求过滤:只处理同源的 GET 请求
- 添加缓存回退检查:如果 caches.match() 返回空,返回 408 错误响应
- 确保 event.respondWith() 始终接收有效的 Response 对象
## 代码变更
public/service-worker.js:
- 添加同源请求检查 (startsWith(self.location.origin))
- 添加 GET 请求过滤
- 添加 .then(response => ...) 处理缓存未命中情况
- 返回 408 Request Timeout 响应作为最终后备
## 验证
- ✅ npm run build 构建成功
- ✅ Service Worker 不再报错
- ✅ 网络请求正常工作
|
2025-11-10 17:45:12 +08:00 |
|
zdl
|
21564ebf4d
|
feat(bytedesk): 集成 Bytedesk 客服系统
新增 Bytedesk 在线客服功能,支持实时对话:
组件:
- BytedeskWidget: 客服浮窗组件(右下角)
- 配置文件: bytedesk.config.js 统一管理配置
- 环境变量示例: .env.bytedesk.example
集成方式:
- GlobalComponents 引入 BytedeskWidget
- public/index.html 加载 bytedesk-web.js 脚本
- 支持环境变量配置(ORG、SID、API_URL)
配置说明详见 src/bytedesk-integration/.env.bytedesk.example
🔧 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
|
2025-11-10 17:26:42 +08:00 |
|
zdl
|
f9b580c871
|
feat: bundle升级
|
2025-11-06 13:30:28 +08:00 |
|
zdl
|
a512f3bd7e
|
feat: 添加缺失的图标文件(logo192.png, badge.png)
|
2025-11-04 17:46:53 +08:00 |
|
zdl
|
6e5eaa9089
|
feat: 添加serverworker注册事件
|
2025-11-04 15:34:17 +08:00 |
|
zdl
|
094793c022
|
feat: 热门关键词UI调整 数据获取逻辑调整 接入redux
|
2025-10-25 18:22:41 +08:00 |
|
zdl
|
2d9d047a9f
|
feat: 添加mock数据,给导航添加选中标识
|
2025-10-17 15:01:35 +08:00 |
|
zdl
|
495ad758ea
|
feat: 10.10线上最新代码提交
|
2025-10-11 16:16:02 +08:00 |
|
|
|
8107dee8d3
|
Initial commit
|
2025-10-11 12:02:01 +08:00 |
|