fix(web): 左上角自己头像接入真实数据,会话订阅失败不再静默吞错
NavRail 的自己头像此前是硬编码的"我"字,AppShell 从没往下传过真实的
user_id/nickname/avatar_file_id,所以无论是谁登录、有没有上传头像都不会变;
现在改为拉取 /v1/im/me 并用 Avatar 组件渲染,和设置页/联系人等处一致。
ConversationView 打开会话失败时原来是 .catch(() => {}) 整个吞掉,用户会看到
空白的消息列表且没有任何提示;由于已读回执只在拿到消息后才会发,未读角标
也会因此永久卡住。现在失败会弹出错误提示,不再静默。
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 5
parent
d5fc03db0e
commit
70cc977e16
@@ -129,10 +129,16 @@ export function ConversationView() {
|
||||
|
||||
useEffect(() => {
|
||||
if (!topicId) return undefined;
|
||||
openConversation(topicId).catch(() => {});
|
||||
// Unlike every other action in this component (see showError's own comment above), a failed
|
||||
// subscribe here used to just vanish into an empty `.catch(() => {})` -- the user would land on
|
||||
// a totally blank message list with no error, no retry, and (since the noteRead effect below
|
||||
// only fires once `messages.length > 0`) a read receipt that can never be sent, leaving the chat
|
||||
// list's unread badge permanently stuck for a conversation that in fact never loaded at all.
|
||||
openConversation(topicId).catch((err) => showError(err, '加载会话失败,请重试'));
|
||||
return () => {
|
||||
closeConversation(topicId).catch(() => {});
|
||||
};
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [topicId]);
|
||||
|
||||
// useLayoutEffect, not useEffect -- this component never remounts on topicId change (route is
|
||||
|
||||
Reference in New Issue
Block a user