fix: resolve duplicate voice user in federated channel sidebar

Use origin-aware user ID resolution for optimistic voice add/remove
instead of always using the home instance ID. Adds getMyUserIdForOrigin
resolver (same pattern as getApiForOrigin) so joinVoiceChannel and
leaveVoice use the correct federated user ID. Also fixes WS reconnect
voice re-registration, invite URL for remote servers, and chatStore
early-load guard for unmapped channels.
This commit is contained in:
Jannis Braun
2026-03-07 14:33:37 +01:00
parent a9a68187b0
commit d18d9c51f7
7 changed files with 54 additions and 17 deletions
+4 -1
View File
@@ -132,9 +132,12 @@ export const useChatStore = create<ChatState>((set, get) => ({
loadMessages: async (channelId: string, force?: boolean) => {
if (!force && get().hasMore.has(channelId)) return;
const isDm = isDmChannel(channelId);
// For server channels, bail if we don't know which instance owns this channel yet.
// The remote WS ready handler will call loadMessages once the map is populated.
if (!isDm && !useServerStore.getState().channelOriginMap.has(channelId)) return;
set({ isLoading: true, loadError: null });
try {
const isDm = isDmChannel(channelId);
const origin = getChannelOrigin(channelId);
const client = getApiForOrigin(origin);
const messages = isDm