You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
client.js?rev=<plugin-rev>:186 Uncaught TypeError: Cannot read properties of undefined (reading 'turn')
at Object.buildLocationData (client.js?rev=<plugin-rev>:186:31)
at ConversationNodeAssembler.buildLocationData (client.js?rev=<runtime-rev>:6812:37)
at ConversationNodeAssembler.replaceLocationData (client.js?rev=<runtime-rev>:6824:25)
at ConversationNodeAssembler.flush (client.js?rev=<runtime-rev>:6444:11)
at Notifier.rebuild (client.js?rev=<runtime-rev>:7169:24)
at Notifier.flush (client.js?rev=<runtime-rev>:5715:11)
at publish (client.js?rev=<runtime-rev>:5700:11)
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
问题描述
打开带历史记录的会话时,聊天视图永远停留在"加载中"。浏览器控制台显示:插件
buildLocationDatahook 抛出的未捕获 TypeError,穿透ConversationNodeAssembler.flush→Notifier.rebuild,导致整个会话重建被中断。单个插件 hook 出错会拖垮整条历史渲染链路,且没有任何降级、错误提示或重试机制。复现步骤
dsh web,加载任意一个未对context.state === void 0做守卫的客户端插件(即注册了turn作用域定义的插件,见下方最小示例)。turn/start事件不在窗口内"的轮次(历史分页加载 / 启动时窗口截断)。出问题的插件 hook 最小示例(与复现者插件行为一致):
预期行为
Notifierflush / 历史重建。buildLocationData在context.state === void 0时必须返回null;这一约束应由引擎侧强制或文档化。实际行为
UI 后果:聊天视图永不渲染,无限停留在"加载中"。
环境
0.1.0-rc.7v24.18.0web根因分析
问题分两层:
replaceLocationData()会遍历所有已匹配的 context(this.contexts.values()),其中包括"turn/start尚未进入已加载窗口"的 context;运行时对这些 context 会显式把state置为void 0(replayContexts分支:if (context.start === void 0) context.state = void 0)。插件若不做守卫直接读context.state.turn就会崩溃。内置dsh-client-ui-deliverables定义展示了正确的契约写法:ConversationNodeAssembler.buildLocationData(以及buildNode)调用 definition hook 时没有 try/catch。抛错会穿透flush()→Notifier.rebuild()→Notifier.flush()→publish(),直接杀死整个会话重建。同时 UI 没有任何错误/重试状态,于是永久卡死。建议修复方案(按优先级)
buildLocationData、buildViewNode)包进 try/catch;抛错时console.error并返回null,让插件降级为"数据位缺失",而不是拖垮整个重建。context.state === void 0的 context 直接跳过buildLocationData调用(引擎本来就知道这是合法状态);或在ConversationNodeDefinition的类型/文档中强制约定"无 state 时返回 null"。Notifier.rebuild失败目前让 UI 无限停留在"加载中";应改为呈现错误/重试状态。临时规避方案(本地)
context.state === void 0时返回null(与内置契约一致)。dsh-client-runtime/lib/client.js的buildLocationData/buildNode做同样的 try/catch 加固,然后强制刷新 GUI。All reactions