@@ -278,7 +278,7 @@ function Root(props: RootProps) {
278278 [ connectorVisibilityMap , chainNamespaces , config , deviceDetails . platform , isWalletConnectConnectorIncluded ]
279279 ) ;
280280
281- const allButtons = useMemo ( ( ) => {
281+ const allRegistryButtons = useMemo ( ( ) => {
282282 return [ ...generateWalletButtons ( walletRegistry . default ) , ...generateWalletButtons ( walletRegistry . others ) ] ;
283283 } , [ generateWalletButtons , walletRegistry . default , walletRegistry . others ] ) ;
284284
@@ -303,7 +303,7 @@ function Root(props: RootProps) {
303303 const metamaskConnectorIdx = installedConnectors . findIndex ( ( x ) => x . name === WALLET_CONNECTORS . METAMASK && ! x . hasInjectedWallet ) ;
304304 if ( metamaskConnectorIdx !== - 1 ) {
305305 const metamaskConnector = installedConnectors [ metamaskConnectorIdx ] ;
306- let metamaskRegistryButton = allButtons . find ( ( button ) => button . name === WALLET_CONNECTORS . METAMASK ) ;
306+ let metamaskRegistryButton = allRegistryButtons . find ( ( button ) => button . name === WALLET_CONNECTORS . METAMASK ) ;
307307 if ( ! metamaskRegistryButton ) {
308308 // use the default metamask registry item if it's not in the registry
309309 metamaskRegistryButton = generateWalletButtons ( {
@@ -321,7 +321,7 @@ function Root(props: RootProps) {
321321
322322 // make metamask the first button and limit the number of buttons
323323 return installedConnectors ;
324- } , [ allButtons , config , connectorVisibilityMap , generateWalletButtons ] ) ;
324+ } , [ allRegistryButtons , config , connectorVisibilityMap , generateWalletButtons ] ) ;
325325
326326 const customConnectorButtons = useMemo ( ( ) => {
327327 return installedConnectorButtons . filter ( ( button ) => ! button . hasInjectedWallet ) ;
@@ -336,14 +336,20 @@ function Root(props: RootProps) {
336336 . slice ( 0 , displayInstalledExternalWallets ? MAX_TOP_INSTALLED_CONNECTORS : 1 ) ;
337337 } , [ installedConnectorButtons , displayInstalledExternalWallets ] ) ;
338338
339- const totalExternalWallets = useMemo ( ( ) => {
340- const uniqueWalletSet = new Set ( ) ;
341- return allButtons . concat ( installedConnectorButtons ) . filter ( ( button ) => {
342- if ( uniqueWalletSet . has ( button . name ) ) return false ;
343- uniqueWalletSet . add ( button . name ) ;
339+ const allExternalWallets = useMemo ( ( ) => {
340+ const uniqueButtonSet = new Set ( ) ;
341+ return installedConnectorButtons . concat ( allRegistryButtons ) . filter ( ( button ) => {
342+ if ( uniqueButtonSet . has ( button . name ) ) return false ;
343+ uniqueButtonSet . add ( button . name ) ;
344344 return true ;
345+ } ) ;
346+ } , [ allRegistryButtons , installedConnectorButtons ] ) ;
347+
348+ const remainingUndisplayedWallets = useMemo ( ( ) => {
349+ return allExternalWallets . filter ( ( button ) => {
350+ return ! topInstalledConnectorButtons . includes ( button ) ;
345351 } ) . length ;
346- } , [ allButtons , installedConnectorButtons ] ) ;
352+ } , [ allExternalWallets , topInstalledConnectorButtons ] ) ;
347353
348354 const handleSocialLoginHeight = ( ) => {
349355 setIsSocialLoginsExpanded ( ( prev ) => ! prev ) ;
@@ -481,7 +487,8 @@ function Root(props: RootProps) {
481487 installedExternalWalletConfig = { topInstalledConnectorButtons }
482488 isEmailPasswordLessLoginVisible = { isEmailPasswordLessLoginVisible }
483489 isSmsPasswordLessLoginVisible = { isSmsPasswordLessLoginVisible }
484- totalExternalWallets = { totalExternalWallets }
490+ totalExternalWallets = { allExternalWallets . length }
491+ remainingUndisplayedWallets = { remainingUndisplayedWallets }
485492 logoAlignment = { logoAlignment }
486493 buttonRadius = { buttonRadiusType }
487494 deviceDetails = { deviceDetails }
@@ -499,7 +506,7 @@ function Root(props: RootProps) {
499506 metamaskConnectUri = { modalState . metamaskConnectUri }
500507 config = { modalState . externalWalletsConfig }
501508 walletRegistry = { walletRegistry }
502- allExternalButtons = { allButtons }
509+ allRegistryButtons = { allRegistryButtons }
503510 connectorVisibilityMap = { connectorVisibilityMap }
504511 customConnectorButtons = { customConnectorButtons }
505512 deviceDetails = { deviceDetails }
0 commit comments