Skip to content

Commit 9272c4c

Browse files
committed
automatically show all wallets if below the show more wallets threshold
1 parent 57587c0 commit 9272c4c

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

packages/modal/src/ui/components/ConnectWallet/ConnectWallet.tsx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { ANALYTICS_EVENTS, type ChainNamespaceType, log, type WALLET_CONNECTOR_TYPE, WALLET_CONNECTORS } from "@web3auth/no-modal";
2-
import { FormEvent, useContext, useMemo, useState } from "react";
2+
import { FormEvent, useContext, useEffect, useMemo, useState } from "react";
33

44
import { CONNECT_WALLET_PAGES } from "../../constants";
55
import { AnalyticsContext } from "../../context/AnalyticsContext";
@@ -153,6 +153,13 @@ function ConnectWallet(props: ConnectWalletProps) {
153153
return walletDiscoverySupported ? defaultButtons.length : installedWalletButtons.length;
154154
}, [walletDiscoverySupported, defaultButtons, installedWalletButtons, isShowAllWallets, totalExternalWalletsCount]);
155155

156+
// Automatically show all wallets if there are less than 15 wallets
157+
useEffect(() => {
158+
if (walletDiscoverySupported && !walletSearch && totalExternalWalletsCount > 0 && totalExternalWalletsCount < 15) {
159+
setIsShowAllWallets(true);
160+
}
161+
}, [walletDiscoverySupported, walletSearch, totalExternalWalletsCount]);
162+
156163
/**
157164
* Wallet click logic
158165
* - For installed wallets

0 commit comments

Comments
 (0)