From d33d5c5061337d2e7548c7cbe32076c7fa1d2e97 Mon Sep 17 00:00:00 2001 From: chambaz Date: Fri, 27 Sep 2024 10:05:58 -0400 Subject: [PATCH] fix: remove isUserFetched dependency from onboarding social --- .../onboarding/social/onboarding-social.tsx | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/packages/mrgn-ui/src/components/wallet-v2/components/sign-up/components/onboarding/social/onboarding-social.tsx b/packages/mrgn-ui/src/components/wallet-v2/components/sign-up/components/onboarding/social/onboarding-social.tsx index bf4e265305..87d5b93dc0 100644 --- a/packages/mrgn-ui/src/components/wallet-v2/components/sign-up/components/onboarding/social/onboarding-social.tsx +++ b/packages/mrgn-ui/src/components/wallet-v2/components/sign-up/components/onboarding/social/onboarding-social.tsx @@ -24,7 +24,6 @@ import { export const OnboardingSocial = ({ mrgnState, - userDataFetched, flow, isLoading, isActiveLoading, @@ -44,10 +43,7 @@ export const OnboardingSocial = ({ const [successProps, setSuccessProps] = React.useState(); const [isSocialAuthLoading, setIsSocialAuthLoading] = React.useState(false); - const userHasAcct = React.useMemo( - () => userDataFetched && mrgnState?.selectedAccount, - [mrgnState?.selectedAccount, userDataFetched] - ); + const userHasAcct = React.useMemo(() => mrgnState?.selectedAccount, [mrgnState?.selectedAccount]); const screen = React.useMemo(() => { if (installingWallet) { @@ -75,7 +71,7 @@ export const OnboardingSocial = ({ }, [screenIndex]); React.useEffect(() => { - if (connected && userDataFetched && screenIndex === 0) { + if (connected && screenIndex === 0) { setIsActiveLoading(""); setIsLoading(false); setIsSocialAuthLoading(false); @@ -85,10 +81,10 @@ export const OnboardingSocial = ({ if (userHasAcct) { setScreenIndex((prev) => prev++); } - } else if (connected && !userDataFetched && screenIndex === 0) { + } else if (connected && screenIndex === 0) { setIsSocialAuthLoading(true); } - }, [userDataFetched, userHasAcct, connected, screenIndex]); + }, [userHasAcct, connected, screenIndex]); const onSelectWallet = React.useCallback( (selectedWallet: ExtendedWallet) => { @@ -137,7 +133,7 @@ export const OnboardingSocial = ({ /> {isSocialAuthLoading ? ( - + ) : ( React.createElement(screen.comp, { isLoading: isLoading,