Skip to content

Commit

Permalink
bring recent to top
Browse files Browse the repository at this point in the history
  • Loading branch information
lochie committed Nov 30, 2023
1 parent c900f82 commit eaea3b6
Showing 1 changed file with 16 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,22 @@ const ConnectorList = () => {
const injectedWallet = useInjectedWallet();

const wallets = useWallets();
const walletsToDisplay = wallets;
const walletsToDisplay = context.options?.hideRecentBadge
? wallets
: [
// move last used wallet to top of list
// using .filter and spread to avoid mutating original array order with .sort
...wallets.filter(
(wallet) =>
lastConnectorId ===
`${wallet.connector.id}-${wallet.connector.name}`
),
...wallets.filter(
(wallet) =>
lastConnectorId !==
`${wallet.connector.id}-${wallet.connector.name}`
),
];

return (
<ScrollArea>
Expand Down

0 comments on commit eaea3b6

Please sign in to comment.