fix: cache federated user identity from WS ready to fix server mute/deafen

getMyUserIdForOrigin relied on instanceStore resolver which could return
the home user ID during connection errors. Cache the authoritative user
ID directly from the WS ready payload, ensuring effective-state
computations use the correct federated identity.
This commit is contained in:
Jannis Braun
2026-03-09 23:01:19 +01:00
parent 907f8285cd
commit 11a69fe92a
2 changed files with 18 additions and 1 deletions
+6 -1
View File
@@ -1,6 +1,6 @@
import React, { useEffect, useRef } from 'react';
import { useAuthStore } from '../stores/authStore';
import { useSpaceStore, getChannelOrigin, getMyUserIdForOrigin } from '../stores/spaceStore';
import { useSpaceStore, getChannelOrigin, getMyUserIdForOrigin, setMyUserIdForOrigin } from '../stores/spaceStore';
import { useChatStore } from '../stores/chatStore';
import { useVoiceStore } from '../stores/voiceStore';
import { useSocialStore } from '../stores/socialStore';
@@ -109,6 +109,11 @@ function handleEvent(origin: string, event: ServerEvent): void {
populateFromReady(origin, event.spaces, event.folders, event.dmChannels);
// Cache authoritative identity for this origin (federation-safe)
if (!isHome) {
setMyUserIdForOrigin(origin, event.user.id);
}
// Mark remote instance as connected in instanceStore
if (!isHome) {
import('../stores/instanceStore').then(({ useInstanceStore }) => {