Repository navigation
fix(webui): keep late history pages out of the next chat - #2628
Merged
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary / 概要
把「加载更早」绑定到渲染该按钮时的路由。分页响应返回时先检查读者是否还在这一次会话访问中,再合并消息和游标。页面重新渲染后也会检查路由,以免给新页面调整滚动位置。读者停留在同一会话时,实时更新会复用路由对象,进行中的翻页仍能完成。
Requirement link / 需求关联
Closes #2627
Before and after / 浏览器实测
在手机视口中暂缓 A 的历史页,等 B 显示后再放行。以下结果来自同一个浏览器回归用例。
374317cb89e2138Older message from A70(A 的游标)40(B 的游标)用例还在 B 的历史页返回前触发一次实时刷新,验证 B 自己的旧消息照常出现,并在最后一页收起「加载更早」。浏览器回归测试
Testing / 验证
89e2138上运行 6 项浏览器 E2E 和 18 项 LAN WebUI 相关测试,24 项全部通过。环境为 macOS arm64、Electron 43.6.0,使用本机回环服务和合成会话。node --check。PR 基线、架构、Biome、样式令牌及差异格式检查均通过。node --test apps/desktop/test/lan-webui-*.test.mjs \ apps/desktop/test/lan-webui-browser-user-path.e2e.mjs