From 95c27a1aa2734548ff0941d3f51c09b0c8abfbf4 Mon Sep 17 00:00:00 2001 From: aashish00021 Date: Thu, 27 Aug 2026 14:24:22 +0530 Subject: [PATCH] fix: sync relationship changes for users not in the local cache UserRelationship events are re-dispatched as UserUpdate, which only applies changes to users already present in the collection (getOrPartial returns undefined for unknown ids when partials are disabled, the default). As a result, a relationship change (friend request accepted/received, block, unblock, etc.) made on another client is silently dropped on this client if it has never cached that user, until the next full resync. Ensure the user exists in the collection via getOrCreate using the data already included in the event, matching how Ready hydrates users on initial sync. Signed-off-by: aashish00021 --- src/events/v1.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/events/v1.ts b/src/events/v1.ts index bfc71828..868a472f 100644 --- a/src/events/v1.ts +++ b/src/events/v1.ts @@ -905,6 +905,10 @@ export async function handleEvent( break; } case "UserRelationship": { + // Live UserUpdate events are dropped for unknown users (see UserUpdate + // below), so make sure this user exists in the cache before delegating. + client.users.getOrCreate(event.user._id, event.user); + handleEvent( client, {