根因:tinode-sdk自己的合并工具mergeObj(utils.js)对Date类型字段有"保留更新 的值"的防护,但普通数字字段(seq/read/recv/unread)完全没有防护,谁的数据 后到就直接覆盖——读源码逐行确认。startMeReconciliation()新增的定时/切换焦点 触发的withLaterSub()增量拉取一旦命中"服务端返回的read游标还没跟上客户端刚 发出的已读回执"这种时序,就会把已经读过的会话悄悄改回未读:角标无缘无故重新 出现,且重新聚焦窗口也不会清除,因为对这个会话来说根本没有发生任何新事情去 重新触发标记已读。 修复:reconcileMeSubs()改成在发起这次增量拉取前,先给所有已知会话的 seq/read/recv/unread拍个快照;拉取完成后,对每个"拉取前就已经认识"的会话, 如果发现seq没变但unread反而变多了,直接把read/recv/unread改回快照里的值并 触发通知——只有真正全新的会话(拉取前不认识)才信任这次拉取回来的数据,这 本来就是这个兜底机制存在的唯一目的。 实机验证:monkey-patch me.getMeta,让它在真实网络请求返回后额外注入一条 过期的sub记录(模拟服务端读游标滞后),再用真实的focus事件触发 reconcileMeSubs()整条链路——确认最终状态仍然正确显示已读,而不是被污染。 Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
React + TypeScript + Vite
This template provides a minimal setup to get React working in Vite with HMR and some Oxlint rules.
Currently, two official plugins are available:
- @vitejs/plugin-react uses Oxc
- @vitejs/plugin-react-swc uses SWC
React Compiler
The React Compiler is not enabled on this template because of its impact on dev & build performances. To add it, see this documentation.
Expanding the Oxlint configuration
If you are developing a production application, we recommend enabling type-aware lint rules by installing oxlint-tsgolint and editing .oxlintrc.json:
{
"$schema": "./node_modules/oxlint/configuration_schema.json",
"plugins": ["react", "typescript", "oxc"],
"options": {
"typeAware": true
},
"rules": {
"react/rules-of-hooks": "error",
"react/only-export-components": ["warn", { "allowConstantExport": true }]
}
}
See the Oxlint rules documentation for the full list of rules and categories.