Skip to content

Commit 2bbd098

Browse files
committed
refactor: only show update button when content of display name has been updated
1 parent 20e970e commit 2bbd098

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

apps/web/src/views/settings/components/UpdateDisplayNameForm.tsx

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -69,16 +69,18 @@ const UpdateDisplayNameForm = ({ displayName }: { displayName: string }) => {
6969
<div className="mb-4 flex w-full max-w-[325px] items-center gap-2">
7070
<Input {...register("name")} errorMessage={errors.name?.message} />
7171
</div>
72-
<div>
73-
<Button
74-
onClick={handleSubmit(onSubmit)}
75-
variant="primary"
76-
disabled={!isDirty || updateDisplayName.isPending}
77-
isLoading={updateDisplayName.isPending}
78-
>
79-
{t`Update`}
80-
</Button>
81-
</div>
72+
{isDirty && (
73+
<div>
74+
<Button
75+
onClick={handleSubmit(onSubmit)}
76+
variant="primary"
77+
disabled={updateDisplayName.isPending}
78+
isLoading={updateDisplayName.isPending}
79+
>
80+
{t`Update`}
81+
</Button>
82+
</div>
83+
)}
8284
</div>
8385
);
8486
};

0 commit comments

Comments
 (0)