fix: load social data on WS ready and use federation-safe canonical matching for friend button state
Friends/requests were only loaded when FriendsPage or ActivityPanel rendered, so profile modals in space views always showed "Add Friend" even for existing friends. Now loadFriends/loadRequests fire on every WS ready event. Also adds canonicalUserMatch() with cascading ID/homeUserId/username+instance fallback, replacing fragile homeUserId-only matching in getFriendshipStatus.
This commit is contained in:
@@ -263,6 +263,15 @@ function handleEvent(origin: string, event: ServerEvent): void {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Load social data so profile modals show correct friendship state.
|
||||
// Runs on each ready (home + remote) — loadFriends/loadRequests fan out
|
||||
// across all connected instances and replace the arrays (idempotent).
|
||||
{
|
||||
const { loadFriends, loadRequests } = useSocialStore.getState();
|
||||
loadFriends();
|
||||
loadRequests();
|
||||
}
|
||||
break;
|
||||
|
||||
case 'message_created':
|
||||
|
||||
Reference in New Issue
Block a user