审查了所有"读取消息content做数据处理"的地方,找到两处和转发bug同一根因 (手机端扁平非Drafty内容格式)的真实问题: 1. 查找聊天记录(HistorySearchModal)的搜索结果渲染,对手机端发送的图片/文件/ 语音/视频/名片消息命中关键词时会让整个应用崩溃——Drafty.toPlainText在这 类扁平内容上返回undefined,highlightMatches对undefined调用.toLowerCase() 直接抛异常,而这个应用完全没有错误边界(ErrorBoundary)兜底,等于白屏。 已用真实搜索接口返回确认snapshot里其实带着head字段(此前SearchHit类型 没建模),据此在渲染前识别这几种扁平内容并显示[图片]/[文件]/[语音]/[名片] 这样的占位文案,不再无脑喂给renderDrafty;顺手给highlightMatches补了防御 性判空,避免类似疏漏再次崩溃整个应用。 2. 消息右键菜单"复制"功能,对手机端发送的扁平文本消息(如群公告自动发布的 那条)和图片/文件/语音/视频消息,复制到剪贴板的是字面字符串"undefined"。 文本类修成正确提取真实文本;附件类直接从"复制"这个操作里去掉(参考名片/ 通话记录消息已有的排除逻辑),复制一段JSON式的附件数据本来就没有意义。 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.