Skip to content

Commit cee73a5

Browse files
committed
fix: avoid running hooks conditionally
1 parent eb52ac0 commit cee73a5

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

packages/vechain-kit/src/components/WalletButton/WalletDisplay.tsx

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,6 @@ type WalletDisplayProps = {
1313
export const WalletDisplay = ({ variant }: WalletDisplayProps) => {
1414
const { account } = useWallet();
1515
const [isSmallMobile] = useMediaQuery('(max-width: 480px)');
16-
if (!account) return <Spinner />;
17-
18-
if (variant === 'icon') {
19-
return null;
20-
}
2116

2217
const accountDomain = useMemo(() => {
2318
const isLongDomain = account?.domain && account.domain.length > 18;
@@ -26,6 +21,12 @@ export const WalletDisplay = ({ variant }: WalletDisplayProps) => {
2621
: account?.domain;
2722
}, [isSmallMobile, account?.domain]);
2823

24+
if (!account) return <Spinner />;
25+
26+
if (variant === 'icon') {
27+
return null;
28+
}
29+
2930
if (variant === 'iconAndDomain') {
3031
return account.domain ? (
3132
<Text fontSize="sm">{accountDomain}</Text>

0 commit comments

Comments
 (0)