diff --git a/web/src/features/groups/GroupDetailColumn.tsx b/web/src/features/groups/GroupDetailColumn.tsx index ce47638e..fdb842ab 100644 --- a/web/src/features/groups/GroupDetailColumn.tsx +++ b/web/src/features/groups/GroupDetailColumn.tsx @@ -171,6 +171,11 @@ export function GroupDetailColumn({ topicId, peerName, onClose, onOpenHistory }: onSuccess: (data) => { queryClient.setQueryData(['group', topicId], (prev: GroupProfile | undefined) => (prev ? { ...prev, ...data } : data)); setNameEditing(false); + // The renamer's OWN sidebar/header (`contact.public?.fn`, native SDK state) doesn't update from + // this REST call either -- only from the `group.profile.updated` push topics.ts now listens for, + // which this account won't receive for its own action. Trigger the same SDK-sanctioned refresh + // directly instead of waiting on an unconfirmed self-echo of that push. + tinode.getTopic(topicId).getMeta(tinode.getTopic(topicId).startMetaQuery().withDesc().build()).catch(() => {}); }, onError: (err) => showError(err, '群名保存失败'), }); diff --git a/web/src/lib/tinode/topics.ts b/web/src/lib/tinode/topics.ts index f008d6ad..648eea0c 100644 --- a/web/src/lib/tinode/topics.ts +++ b/web/src/lib/tinode/topics.ts @@ -298,6 +298,20 @@ function wireTopicCallbacks(topic: Topic) { topic.getMeta(topic.startMetaQuery().withData(seq, seq + 1, 1).build()).catch(() => {}); } } + // docs/IM-前后端对接文档.md:1542: `PATCH .../groups/{topic}` (rename/avatar/description) pushes a + // custom `{info what:"group", event:"group.profile.updated"}` to every other online member -- same + // undocumented-to-the-SDK shape as `group.dissolved` above, so nothing here ever refreshed the + // topic's native `public` fields on receipt. Live-confirmed the actual gap: the sidebar/header name + // comes from `contact.public?.fn` (native SDK state, see ChatListColumn.tsx), which a REST-only + // mutation never touches for ANYONE -- not just other members, but the renamer's own other tabs/ + // views too -- and only ever got refreshed as a side effect of the unrelated focus-triggered + // `reconcileMeSubs()`, which is why refocus "fixed" it for everyone. `withDesc()` is the SDK's own + // sanctioned way to re-pull `public`/description from the server (contrast the abandoned approach + // of manually patching `Topic._processMetaDesc` tried earlier for a different bug -- that one was + // reverted for inconclusive verification; this one goes through a real server round-trip instead). + if (groupEvent?.what === 'group' && groupEvent.event === 'group.profile.updated') { + topic.getMeta(topic.startMetaQuery().withDesc().build()).catch(() => {}); + } }; topic.onMetaDesc = notify; // Only ever actually invoked on the `me` topic (the SDK reads `me.onMetaSub`/`me.onSubsUpdated`