-
Notifications
You must be signed in to change notification settings - Fork 209
Description
[REQUIRED] Environment
- Browser version: Chrome Version 143.0.7499.194
- AA SDK version: ^4.67.0
- Package: "@account-kit/react" ,
[REQUIRED] Describe the problem
The useAuthModal hook does not automatically close the modal after a successful connection with a standard Wagmi wallet (e.g., MetaMask).
When a user triggers openAuthModal and selects a non-smart wallet (like MetaMask) via the "External Wallets" option, the wallet connects successfully, but the modal remains open. If the user then manually clicks the close button on the modal, it triggers a disconnect event, effectively preventing the user from staying logged in.
This issue does not affect the Smart Wallet login flows (e.g., Google or Email login), which close the modal correctly upon success.
How to reproduce:
-
Implement useAuthModal in a React component.
-
Call openAuthModal() to trigger the login UI.
-
Select an external wallet (e.g., MetaMask) from the options.
-
Complete the connection in the wallet extension.
-
Observe: The wallet connects (address is available), but the Auth Modal remains visible on screen.
-
Observe: Clicking the "X" or close button on the modal disconnects the wallet immediately.
Relevant code or sample repro:
import { useAuthModal, useUser } from "@account-kit/react";
export const LoginButton = () => {
const { openAuthModal } = useAuthModal();
const user = useUser();
// Issue: Modal stays open after user connects MetaMask here
return (
<div>
<button onClick={openAuthModal}>Login</button>
{user && <p>Connected: {user.address}</p>}
</div>
);
};