mirror of
https://github.com/SableClient/Sable.git
synced 2026-12-02 23:02:33 -08:00
perf: optimize profile cache updating
This commit is contained in:
1 file changed
+4
-7
@@ -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) {
|
||||
|
||||
Reference in new issue
Block a user