From 9092addd9cb516293de897099414ab5ffa43d852 Mon Sep 17 00:00:00 2001 From: Udit Takkar <53316345+Udit-takkar@users.noreply.github.com> Date: Sat, 12 Nov 2022 01:57:09 +0530 Subject: [PATCH] fix: use .watch() to disable update btn (#5482) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix: use .watch() to disable update btn * Apply suggestions from code review Co-authored-by: Peer Richelsen Co-authored-by: Omar López Co-authored-by: alannnc --- apps/web/pages/settings/my-account/profile.tsx | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/apps/web/pages/settings/my-account/profile.tsx b/apps/web/pages/settings/my-account/profile.tsx index 50c920dbed..093b4bde1f 100644 --- a/apps/web/pages/settings/my-account/profile.tsx +++ b/apps/web/pages/settings/my-account/profile.tsx @@ -155,8 +155,7 @@ const ProfileView = () => { const { reset, - // eslint-disable-next-line @typescript-eslint/no-unused-vars - formState: { dirtyFields }, + formState: { isSubmitting, isDirty }, } = formMethods; useEffect(() => { @@ -197,6 +196,7 @@ const ProfileView = () => { }; if (isLoading || !user) return ; + const isDisabled = isSubmitting || !isDirty; return ( <> @@ -261,7 +261,12 @@ const ProfileView = () => { -