diff --git a/packages/app/src/app/users/(user-profile)/(components)/profile-card.tsx b/packages/app/src/app/users/(user-profile)/(components)/profile-card.tsx index 9140ad8f..c3a3d607 100644 --- a/packages/app/src/app/users/(user-profile)/(components)/profile-card.tsx +++ b/packages/app/src/app/users/(user-profile)/(components)/profile-card.tsx @@ -89,13 +89,15 @@ function EditMode({ const [isLoading, setIsLoading] = React.useState(false); const { toast, dismiss } = useToast(); - async function handleSubmit(e: React.FormEvent) { + const isUnchanged = name === displayName && bio === biography; + + const handleSubmit = async (e: React.FormEvent) => { e.preventDefault(); setIsLoading(true); // if the user clicks save but all information is the same, // just return. - if (name === displayName && bio === biography) { + if (isUnchanged) { changeMode(); setIsLoading(false); return; @@ -104,7 +106,7 @@ function EditMode({ toast( { title: "Updating Information", - description: "Your information is being updated..", + description: "Your information is being updated...", variant: "default", }, "loading-toast" @@ -132,7 +134,7 @@ function EditMode({ changeMode(); setIsLoading(false); } - } + }; return (
@@ -155,13 +157,13 @@ function EditMode({ disabled={isLoading} className="mt-1" /> - {!name ? ( + {!name && (

Name cannot be empty.

- ) : null} + )}
- +
{biography?.length} / 128