diff --git a/src/ui/components/modals/authenticate/authenticate.tsx b/src/ui/components/modals/authenticate/authenticate.tsx index c527af00..bbad35cc 100644 --- a/src/ui/components/modals/authenticate/authenticate.tsx +++ b/src/ui/components/modals/authenticate/authenticate.tsx @@ -26,7 +26,6 @@ export const Authenticate = ({ disconnect, openConnectModal, isLoadingSigner, - hasAddress, } = useWallet(); const [copied, setCopied] = useState(false); @@ -51,6 +50,7 @@ export const Authenticate = ({ needsWalletConnection, showAuthenticateView, showSwitchWalletButton, + showConnectedView, } = useAuthenticateModal({ onAuthenticateError, onAuthenticateSuccess, @@ -62,7 +62,7 @@ export const Authenticate = ({ } let timeout: NodeJS.Timeout; - if (modal.visible && !isAuthenticating && hasAddress) { + if (modal.visible && !isAuthenticating && showConnectedView) { timeout = setTimeout(() => { modal.remove(); // onClose?.(); @@ -75,7 +75,7 @@ export const Authenticate = ({ }, [ needsWalletConnection, modal, - hasAddress, + showConnectedView, isAuthenticating, openConnectModal, ]); diff --git a/src/ui/components/modals/authenticate/use-authenticate-modal.ts b/src/ui/components/modals/authenticate/use-authenticate-modal.ts index d8b85570..72a797c5 100644 --- a/src/ui/components/modals/authenticate/use-authenticate-modal.ts +++ b/src/ui/components/modals/authenticate/use-authenticate-modal.ts @@ -29,6 +29,11 @@ export const useAuthenticateModal = ({ [isConnected, hasSession, signer, hasAddress, isLoadingSession] ); + const showConnectedView = useMemo( + () => hasSession && hasAddress, + [hasSession, hasAddress] + ); + const successMessage = useMemo(() => { switch (company) { case 'Masa': { @@ -80,7 +85,7 @@ export const useAuthenticateModal = ({ needsWalletConnection, showAuthenticateView, successMessage, - + showConnectedView, isAuthenticating, onAuthenticateStart, showSwitchWalletButton,