diff --git a/src/features/account/hooks/useSignInWithWallet.ts b/src/features/account/hooks/useSignInWithWallet.ts index 12f66cd56ac..5300a3d80da 100644 --- a/src/features/account/hooks/useSignInWithWallet.ts +++ b/src/features/account/hooks/useSignInWithWallet.ts @@ -158,7 +158,7 @@ function useSignInWithWallet({ onSuccess, onError, source = 'Login', isAuth, log proceedToAuth(web3Wallet.address); } else { isConnectingWalletRef.current = true; - web3Wallet.openModal(); + web3Wallet.connect(); } }, [ proceedToAuth, web3Wallet ]); diff --git a/src/features/connect-wallet/hooks/wallet/useWalletReown.ts b/src/features/connect-wallet/hooks/wallet/useWalletReown.ts index 8aa33fec4c9..8ca5ada2286 100644 --- a/src/features/connect-wallet/hooks/wallet/useWalletReown.ts +++ b/src/features/connect-wallet/hooks/wallet/useWalletReown.ts @@ -50,20 +50,23 @@ export function useWalletReown({ source, onConnect }: Params): Result { modalUnsubRef.current = runtime.subscribeModalState(setIsModalOpen); }, []); - const openModal = React.useCallback(async() => { + // Loads the runtime and opens the AppKit modal, returning the runtime so `connect` can gate its analytics + // on `isReady`. The exposed `openModal` discards it (the `Result` contract is `Promise`). + const loadAndOpenModal = React.useCallback(async() => { setIsOpening(true); const runtime = await ensureLoaded(); subscribeModal(runtime); await runtime.openModal(); setIsOpening(false); + return runtime; }, [ subscribeModal ]); + const openModal = React.useCallback(async() => { + await loadAndOpenModal(); + }, [ loadAndOpenModal ]); + const connect = React.useCallback(async() => { - setIsOpening(true); - const runtime = await ensureLoaded(); - subscribeModal(runtime); - await runtime.openModal(); - setIsOpening(false); + const runtime = await loadAndOpenModal(); // Record a started connection only when the modal could actually open. A failed chunk load resolves to // the disabled runtime whose `openModal` is a no-op — there is nothing for the user to complete, and no // later bridge connect to attribute to this click. @@ -71,7 +74,7 @@ export function useWalletReown({ source, onConnect }: Params): Result { mixpanel.logEvent(mixpanel.EventTypes.WALLET_CONNECT, { Source: source, Status: 'Started' }); isConnectionStarted.current = true; } - }, [ source, subscribeModal ]); + }, [ source, loadAndOpenModal ]); const disconnect = React.useCallback(async() => { const runtime = await ensureLoaded(); diff --git a/src/features/marketplace/pages/dapp/MarketplaceApp.pw.tsx b/src/features/marketplace/pages/dapp/MarketplaceApp.pw.tsx index f2a25cdd8a0..b2076c03ba7 100644 --- a/src/features/marketplace/pages/dapp/MarketplaceApp.pw.tsx +++ b/src/features/marketplace/pages/dapp/MarketplaceApp.pw.tsx @@ -39,7 +39,7 @@ const testFn = async({ render, mockAssetResponse, mockEnvs, mockRpcResponse, moc await expect(component).toHaveScreenshot(); }; -test('base view +@dark-mode', testFn); +test('base view', testFn); test.describe('mobile', () => { test.use({ viewport: devices['iPhone 13 Pro'].viewport }); diff --git a/src/features/marketplace/pages/dapp/__screenshots__/MarketplaceApp.pw.tsx_dark-color-mode_base-view-dark-mode-1.png b/src/features/marketplace/pages/dapp/__screenshots__/MarketplaceApp.pw.tsx_dark-color-mode_base-view-dark-mode-1.png deleted file mode 100644 index 491409b4663..00000000000 Binary files a/src/features/marketplace/pages/dapp/__screenshots__/MarketplaceApp.pw.tsx_dark-color-mode_base-view-dark-mode-1.png and /dev/null differ diff --git a/src/features/marketplace/pages/dapp/__screenshots__/MarketplaceApp.pw.tsx_default_base-view-dark-mode-1.png b/src/features/marketplace/pages/dapp/__screenshots__/MarketplaceApp.pw.tsx_default_base-view-1.png similarity index 100% rename from src/features/marketplace/pages/dapp/__screenshots__/MarketplaceApp.pw.tsx_default_base-view-dark-mode-1.png rename to src/features/marketplace/pages/dapp/__screenshots__/MarketplaceApp.pw.tsx_default_base-view-1.png