From 7e219c0a3f212e15112566b1b2eba1c6accf57d8 Mon Sep 17 00:00:00 2001 From: robertu <4065233+robertu7@users.noreply.github.com> Date: Mon, 18 Sep 2023 10:06:15 +0700 Subject: [PATCH] fix(username): fix loadign state of `useAvailableUserName` --- src/components/Dialogs/SetUserNameDialog/hook.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/components/Dialogs/SetUserNameDialog/hook.ts b/src/components/Dialogs/SetUserNameDialog/hook.ts index 8d7f57cd94..4447c8f2be 100644 --- a/src/components/Dialogs/SetUserNameDialog/hook.ts +++ b/src/components/Dialogs/SetUserNameDialog/hook.ts @@ -33,7 +33,7 @@ export const useAvailableUserName = ({ const presetUserName = (viewer.info.email as string) || googleId || facebookId || twitterId - const [loading, setLoading] = useState(!!presetUserName) + const [loading, setLoading] = useState(enable && !!presetUserName) const [index, setIndex] = useState(0) const [availableUserName, setAvailableUserName] = useState('') @@ -46,6 +46,7 @@ export const useAvailableUserName = ({ ) if (!normalizedUserName) { + setLoading(false) return }