zikai
4de2648178
fix: 记事本修改需手动刷新才同步(同浏览器多 tab clientId 共享导致 update 被跳过)
根因:clientId 存 localStorage,同浏览器多个 tab 共享同一 clientId。
前端 onMessage 的 update 分支用 `if (msg.client_id === clientId) break` 跳过
「自己的」更新,但服务端 exclude=conn 是按连接对象排除,非按 client_id。
于是 tab B 编辑后,tab A 收到的 update client_id 等于自己的 clientId,
被误判为「自己的」跳过 -> 不同步,只有手动刷新(重新 init)才看到内容。
修复:
- clientId 改用 sessionStorage(每 tab 独立),不再跨 tab 共享。
- 移除 update 分支的 client_id 跳过逻辑(服务端 exclude=conn 已排除发送者,
前端跳过是多余且会误杀同 client_id 的其他 tab)。
2026-07-22 00:36:44 +00:00
..
2026-07-21 14:28:13 +00:00
2026-07-21 14:52:44 +00:00
2026-07-21 14:37:13 +00:00
2026-07-21 14:37:13 +00:00
2026-07-21 14:37:13 +00:00
2026-07-21 14:28:13 +00:00
2026-07-21 14:28:13 +00:00
2026-07-21 15:00:25 +00:00
2026-07-21 15:00:25 +00:00
2026-07-21 15:04:02 +00:00
2026-07-22 00:36:44 +00:00