From 6854e6564bb51815e3ba2379141e1088d4f6f635 Mon Sep 17 00:00:00 2001 From: Eric Bailey Date: Wed, 5 Feb 2025 11:09:23 -0600 Subject: [PATCH] Clean up upsertProfile types --- src/state/queries/profile.ts | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/state/queries/profile.ts b/src/state/queries/profile.ts index 0b49b24bbd..b50c17f93e 100644 --- a/src/state/queries/profile.ts +++ b/src/state/queries/profile.ts @@ -158,29 +158,29 @@ export function useProfileUpdateMutation() { ) } await agent.upsertProfile(async existing => { - existing = existing || {} + let next: Un$Typed = existing || {} if (typeof updates === 'function') { - existing = updates(existing) + next = updates(next) } else { - existing.displayName = updates.displayName - existing.description = updates.description + next.displayName = updates.displayName + next.description = updates.description if ('pinnedPost' in updates) { - existing.pinnedPost = updates.pinnedPost + next.pinnedPost = updates.pinnedPost } } if (newUserAvatarPromise) { const res = await newUserAvatarPromise - existing.avatar = res.data.blob + next.avatar = res.data.blob } else if (newUserAvatar === null) { - existing.avatar = undefined + next.avatar = undefined } if (newUserBannerPromise) { const res = await newUserBannerPromise - existing.banner = res.data.blob + next.banner = res.data.blob } else if (newUserBanner === null) { - existing.banner = undefined + next.banner = undefined } - return existing + return next }) await whenAppViewReady( agent,