fix(chat): header 助手按钮在话题加载完之前不再消失 - #548
Closed
eeee0717 wants to merge 1 commit into
Closed
Conversation
eeee0717
force-pushed
the
fix/header-assistant-flicker
branch
from
August 15, 2026 13:51
4193b84 to
4195ba5
Compare
`topicId` 一出现就硬切数据源(`topicId ? topic.data?.assistantId : assistantId`),
而 `useTopic` 还在 fetch,于是 assistant 在那几百毫秒里是 null。iOS 上
`Stack.Toolbar` 的 children 数量因此从 2 掉到 1,**两个按钮一起走原生重建**——不是只
少一个,是整组淡出再淡入。
逐帧实测(导航窗口内 header 区暗像素):
- 改前:437 → 261 → 110(几乎全空)→ 398 → 520,跨约 600ms
- 改后:461 → 464,601 帧零变化
改成解析不出来时回落到 URL 上的 assistantId。回落值不会是别的助手:`open-topic` 走
`setParams({ topicId })`,assistantId 原样留在 URL 上且就是这个话题的助手;从话题列表
进来那条路带的 params 只有 topicId,回落到 undefined,与从前一致。
Co-Authored-By: Claude <noreply@anthropic.com>
eeee0717
force-pushed
the
fix/header-assistant-flicker
branch
from
August 15, 2026 13:57
4195ba5 to
287a08f
Compare
Collaborator
Author
|
已合并进 #549 一并 review——这几层都是 bench harness 之后对消息列表的优化,拆开反而不好读。分支保留,需要时可重开。 |
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.
这条 PR 做什么
让 header 的助手按钮在新话题导航期间不再消失。
根因
MainHeaderAssistantButton.tsx里这一行是硬切:topicId一出现就立刻放弃 URL 上还能用的assistantId,去等一个还在 fetch 的值。新话题发出第一条消息时导航先于话题可读,于是
assistant在那几百毫秒里是null。iOS 上后果被放大:
Stack.Toolbar的 children 数量从 2 掉到 1,两个按钮一起走原生重建——不是只少一个,是整组淡出再淡入。
实测
逐帧读 header 区(y 55–105)的暗像素,导航窗口内:
reorder-final)hdrfix)抽帧目视确认:六帧跨越整个导航窗口,两个按钮始终清晰、位置不动、无淡入淡出。
为什么回落是安全的
回落值不会是别的助手:
open-topic走router.setParams({ topicId }),是合并语义 →assistantId原样留在 URL上,而它就是这个话题的助手(话题正是用它建的)。
TopicList.tsx的{ pathname: '/topics', params: { topicId } })带的 params 只有
topicId,回落到undefined,与从前完全一致。新增测试
keeps the route assistant while the topic is still loading钉住这个行为。备注
ChatInput里有同一个模式的数据源硬切(selectedAssistantId),这次没有一并改——它的症状是模型胶囊闪一下,不涉及原生 toolbar 重建,值得单独判断。