Skip to content

Commit

Permalink
fix: simplify wallet filtering logic in RenderWalletList component
Browse files Browse the repository at this point in the history
  • Loading branch information
ericHgorski committed Dec 23, 2024
1 parent a8f591e commit 068457e
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions packages/widget/src/components/RenderWalletList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,7 @@ export const RenderWalletList = ({
(wallet) => isMinimalWallet(wallet) && wallet?.isAvailable !== false
);

// If only walletconnect is available, return the list as is to show install options.
if (filteredWallets.length === 1) return walletList
return filteredWallets.length === 1 ? walletList : filteredWallets;

}, [walletList]);

const clearAssetInputAmounts = useSetAtom(clearAssetInputAmountsAtom);
Expand Down Expand Up @@ -165,12 +162,12 @@ export const RenderWalletList = ({
/>
);
},
[connectMutation, displayWallets]
[connectMutation]
);

const height = useMemo(() => {
return Math.min(530, displayWallets.length * (ITEM_HEIGHT + ITEM_GAP));
}, [walletList, displayWallets]);
}, [walletList]);

Check warning on line 170 in packages/widget/src/components/RenderWalletList.tsx

View workflow job for this annotation

GitHub Actions / eslint

React Hook useMemo has a missing dependency: 'displayWallets.length'. Either include it or remove the dependency array


const renderWalletListOrWalletConnectionStatus = useMemo(() => {
Expand Down Expand Up @@ -230,6 +227,7 @@ export const RenderWalletList = ({
connectMutation.variables?.walletInfo.logo,
connectMutation.variables?.walletPrettyName,
height,
displayWallets,
renderItem,
theme.primary.text.lowContrast,
theme.primary.text.normal,
Expand Down

0 comments on commit 068457e

Please sign in to comment.