From e94becdc3f067cdf6cf39f0929acd0b9b8d40a60 Mon Sep 17 00:00:00 2001 From: 7w1 Date: Thu, 27 Aug 2026 21:29:37 -0500 Subject: [PATCH] perf: optimize profile cache updating --- src/app/hooks/useUserProfile.ts | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/app/hooks/useUserProfile.ts b/src/app/hooks/useUserProfile.ts index 2b494f1fb..e8172fdb6 100644 --- a/src/app/hooks/useUserProfile.ts +++ b/src/app/hooks/useUserProfile.ts @@ -322,13 +322,10 @@ export const useUserProfile = ( return; } const normalized = normalizeInfo(info); - setGlobalProfiles((prev) => { - const { [userId]: previousProfile, ...otherProfiles } = prev; - return { - ...otherProfiles, - [userId]: { ...previousProfile, ...normalized }, - }; - }); + setGlobalProfiles((prev) => ({ + ...prev, + [userId]: { ...prev[userId], ...normalized }, + })); }) .catch(() => { if (getFetchGeneration(mx, userId) !== generation) {