diff --git a/.changeset/fresh-toys-remember.md b/.changeset/fresh-toys-remember.md new file mode 100644 index 00000000000..f7412042c95 --- /dev/null +++ b/.changeset/fresh-toys-remember.md @@ -0,0 +1,5 @@ +--- +"@thirdweb-dev/react": patch +--- + +Fix sign in connect button display logic diff --git a/packages/react/src/wallet/ConnectWallet/ConnectWallet.tsx b/packages/react/src/wallet/ConnectWallet/ConnectWallet.tsx index 5a13e7cccdb..cd69822b052 100644 --- a/packages/react/src/wallet/ConnectWallet/ConnectWallet.tsx +++ b/packages/react/src/wallet/ConnectWallet/ConnectWallet.tsx @@ -169,12 +169,14 @@ export const ConnectWallet: React.FC = (props) => { const { user } = useUser(); const disconnect = useDisconnect(); - const shouldSignIn = !!authConfig?.authUrl && !!address && !user?.address; - const addressAndUserAddressMismatched = address !== user?.address; + const connectedButNotSignedIn = + !!authConfig?.authUrl && + !!address && + (!user?.address || address !== user?.address); const requiresSignIn = props.auth?.loginOptional ? false - : shouldSignIn || addressAndUserAddressMismatched; + : connectedButNotSignedIn; const supportedTokens = useMemo(() => { if (!props.supportedTokens) { @@ -195,10 +197,10 @@ export const ConnectWallet: React.FC = (props) => { // if wallet gets disconnected, close the signature modal useEffect(() => { - if (!activeWallet && !addressAndUserAddressMismatched) { + if (!activeWallet) { setShowSignatureModal(false); } - }, [activeWallet, addressAndUserAddressMismatched]); + }, [activeWallet]); return (