From ee02801b54d6aa51ba5dbdb992ac7f838f3a9172 Mon Sep 17 00:00:00 2001 From: "gpt-engineer-app[bot]" <159125892+gpt-engineer-app[bot]@users.noreply.github.com> Date: Wed, 28 Jan 2026 00:03:19 +0000 Subject: [PATCH] Changes --- src/pages/Account.tsx | 34 ++++++++++++++++++++++++---------- 1 file changed, 24 insertions(+), 10 deletions(-) diff --git a/src/pages/Account.tsx b/src/pages/Account.tsx index 985dff6..3a7ea9b 100644 --- a/src/pages/Account.tsx +++ b/src/pages/Account.tsx @@ -28,12 +28,22 @@ const Account = () => { postal_code: "", city: "", }); + const [originalProfile, setOriginalProfile] = useState({ + street_address: "", + postal_code: "", + city: "", + }); const [isLoading, setIsLoading] = useState(true); const [isSaving, setIsSaving] = useState(false); const { user, loading: authLoading, signOut } = useAuth(); const { toast } = useToast(); const navigate = useNavigate(); + const hasChanges = + profile.street_address !== originalProfile.street_address || + profile.postal_code !== originalProfile.postal_code || + profile.city !== originalProfile.city; + useEffect(() => { if (!authLoading && !user) { navigate("/"); @@ -61,11 +71,13 @@ const Account = () => { variant: "destructive", }); } else if (data) { - setProfile({ + const profileData = { street_address: data.street_address || "", postal_code: data.postal_code || "", city: data.city || "", - }); + }; + setProfile(profileData); + setOriginalProfile(profileData); } } finally { setIsLoading(false); @@ -214,14 +226,16 @@ const Account = () => {

- + {hasChanges && ( + + )}