fix: use .watch() to disable update btn (#5482)
* fix: use .watch() to disable update btn * Apply suggestions from code review Co-authored-by: Peer Richelsen <peeroke@gmail.com> Co-authored-by: Omar López <zomars@me.com> Co-authored-by: alannnc <alannnc@gmail.com>pull/5476/head^2
parent
7f14e00119
commit
9092addd9c
|
@ -155,8 +155,7 @@ const ProfileView = () => {
|
||||||
|
|
||||||
const {
|
const {
|
||||||
reset,
|
reset,
|
||||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
formState: { isSubmitting, isDirty },
|
||||||
formState: { dirtyFields },
|
|
||||||
} = formMethods;
|
} = formMethods;
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
@ -197,6 +196,7 @@ const ProfileView = () => {
|
||||||
};
|
};
|
||||||
|
|
||||||
if (isLoading || !user) return <SkeletonLoader />;
|
if (isLoading || !user) return <SkeletonLoader />;
|
||||||
|
const isDisabled = isSubmitting || !isDirty;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
|
@ -261,7 +261,12 @@ const ProfileView = () => {
|
||||||
<TextField label={t("about")} hint={t("bio_hint")} {...formMethods.register("bio")} />
|
<TextField label={t("about")} hint={t("bio_hint")} {...formMethods.register("bio")} />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<Button color="primary" className="mt-8" type="submit" loading={mutation.isLoading}>
|
<Button
|
||||||
|
disabled={isDisabled}
|
||||||
|
color="primary"
|
||||||
|
className="mt-8"
|
||||||
|
type="submit"
|
||||||
|
loading={mutation.isLoading}>
|
||||||
{t("update")}
|
{t("update")}
|
||||||
</Button>
|
</Button>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue