Skip to content

fix(webui): keep late history pages out of the next chat - #2628

Merged
vastsa merged 1 commit into
vastsa:mainfrom
ZedingZhang:fix/webui-session-message-race
Nov 27, 2026
Merged

vastsa merged 1 commit into
vastsa:mainfrom
ZedingZhang:fix/webui-session-message-race

Conversation

@ZedingZhang

Copy link
Copy Markdown
Contributor

Summary / 概要

把「加载更早」绑定到渲染该按钮时的路由。分页响应返回时先检查读者是否还在这一次会话访问中,再合并消息和游标。页面重新渲染后也会检查路由,以免给新页面调整滚动位置。读者停留在同一会话时,实时更新会复用路由对象,进行中的翻页仍能完成。

Requirement link / 需求关联

Closes #2627

Before and after / 浏览器实测

在手机视口中暂缓 A 的历史页,等 B 显示后再放行。以下结果来自同一个浏览器回归用例。

检查项 上游 374317cb 修复 89e2138
B 是否出现 Older message from A 是 否
B 的下一次历史请求使用的游标 70(A 的游标) 40(B 的游标)

用例还在 B 的历史页返回前触发一次实时刷新,验证 B 自己的旧消息照常出现,并在最后一页收起「加载更早」。浏览器回归测试

Testing / 验证

  • 在候选提交 89e2138 上运行 6 项浏览器 E2E 和 18 项 LAN WebUI 相关测试,24 项全部通过。环境为 macOS arm64、Electron 43.6.0,使用本机回环服务和合成会话。
  • 两个改动的 JavaScript 文件通过 node --check。PR 基线、架构、Biome、样式令牌及差异格式检查均通过。
  • 已同步 LAN WebUI 的分页规格和 E2E-271 验收场景。
node --test apps/desktop/test/lan-webui-*.test.mjs \
  apps/desktop/test/lan-webui-browser-user-path.e2e.mjs

History pagination can finish after the browser has opened another
conversation. Applying that page to shared chat state mixes transcripts
and sends the next history request with the wrong cursor.

Scope the callback to the route that rendered its button. Live updates
can still refresh that route while the reader waits for older messages.
@vastsa
vastsa merged commit da30a57 into vastsa:main Nov 27, 2026
6 checks passed
@ZedingZhang
ZedingZhang deleted the fix/webui-session-message-race branch November 27, 2026 16:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] WebUI 切换会话后,迟到的历史页会把旧会话的消息显示在新会话中

2 participants