From 93a918a7714ab6ac0708ff5f633e45fe6e2e8b7f Mon Sep 17 00:00:00 2001 From: wlee221 Date: Tue, 6 Dec 2022 10:36:16 -0800 Subject: [PATCH] Move `isLoading` check to the top --- .../AccountSettings/DeleteUser/DeleteUser.tsx | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/react/src/components/AccountSettings/DeleteUser/DeleteUser.tsx b/packages/react/src/components/AccountSettings/DeleteUser/DeleteUser.tsx index 63a36194968..4db7481a28c 100644 --- a/packages/react/src/components/AccountSettings/DeleteUser/DeleteUser.tsx +++ b/packages/react/src/components/AccountSettings/DeleteUser/DeleteUser.tsx @@ -71,7 +71,12 @@ function DeleteUser({ runDeleteUser(); }, [runDeleteUser]); - // Return null if user isn't authenticated in the first place + // Return null if Auth.getCurrentAuthenticatedUser is still in progress + if (isLoading) { + return null; + } + + // Return null if user isn't authenticated if (!user) { logger.warn(' requires user to be authenticated.'); return null; @@ -82,11 +87,6 @@ function DeleteUser({ return null; } - // Return null if Auth.getCurrentAuthenticatedUser is still in progress - if (isLoading) { - return null; - } - return (