Skip to content

Commit

Permalink
fix: check for active wallet id (#990)
Browse files Browse the repository at this point in the history
  • Loading branch information
lucas-barros committed Mar 28, 2024
1 parent ec6072d commit f0d9b29
Showing 1 changed file with 5 additions and 1 deletion.
Expand Up @@ -47,6 +47,7 @@ export const UserInfo = ({ onOpenWalletAccounts, avatarVisible = true }: UserInf
const activeWalletName = addEllipsis(fullWalletName, WALLET_NAME_MAX_LENGTH, 0);
const [handle] = useGetHandles();
const handleName = handle?.nftMetadata?.name;
const activeWalletId = cardanoWallet.source.wallet.walletId;

const handleOnAddressCopy = () => {
toast.notify({ duration: TOAST_DEFAULT_DURATION, text: t('general.clipboard.copiedToClipboard') });
Expand Down Expand Up @@ -87,6 +88,9 @@ export const UserInfo = ({ onOpenWalletAccounts, avatarVisible = true }: UserInf
id={`wallet-option-${wallet.walletId}`}
onOpenAccountsMenu={() => onOpenWalletAccounts(wallet)}
onClick={async () => {
if (activeWalletId === wallet.walletId) {
return;
}
analytics.sendEventToPostHog(PostHogAction.MultiWalletSwitchWallet);

await activateWallet({
Expand All @@ -103,7 +107,7 @@ export const UserInfo = ({ onOpenWalletAccounts, avatarVisible = true }: UserInf
/>
);
},
[activateWallet, getLastActiveAccount, onOpenWalletAccounts, setIsDropdownMenuOpen, analytics, t]
[activateWallet, getLastActiveAccount, onOpenWalletAccounts, setIsDropdownMenuOpen, analytics, t, activeWalletId]
);

const renderWallet = useCallback(
Expand Down

0 comments on commit f0d9b29

Please sign in to comment.