From b36b529e70aae6d63ec603ac1adbe5bc0db4d0c7 Mon Sep 17 00:00:00 2001 From: "Builder.io" Date: Sat, 27 Sep 2025 22:08:49 +0000 Subject: [PATCH] Merge profile updates in context to avoid losing fields cgen-ecc6e63dc28e484c864c2300cbf2f9e4 --- client/contexts/AuthContext.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/client/contexts/AuthContext.tsx b/client/contexts/AuthContext.tsx index a2550cec..9f7dd090 100644 --- a/client/contexts/AuthContext.tsx +++ b/client/contexts/AuthContext.tsx @@ -235,12 +235,13 @@ export const AuthProvider: React.FC<{ children: React.ReactNode }> = ({ user.id, updates, ); - setProfile(updatedProfile); + setProfile((prev) => ({ ...(prev || {} as any), ...(updatedProfile || {} as any), ...updates } as any)); aethexToast.success({ title: "Profile updated", description: "Your profile has been updated successfully", }); } catch (error: any) { + setProfile((prev) => ({ ...(prev || {} as any), ...updates } as any)); aethexToast.error({ title: "Update failed", description: error.message,