fix(groups): sync group rename in real time for owner and members
PATCH .../groups/{topic} pushes a custom {info what:"group",
event:"group.profile.updated"} that nothing recognized, so the
sidebar/header name (native SDK contact.public.fn) never refreshed
until an unrelated focus-triggered resync happened to touch it.
Add the missing branch to onInfo (mirrors the existing
group.dissolved/message.recalled handling) to re-pull public/desc
via topic.getMeta(...withDesc()), and trigger the same refresh from
the renamer's own save success since they won't receive their own
push.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 5
parent
0de8c0b5ac
commit
5748f1290d
@@ -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, '群名保存失败'),
|
||||
});
|
||||
|
||||
@@ -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`
|
||||
|
||||
Reference in New Issue
Block a user