Skip to content

Commit a1420a2

Browse files
authored
fix: hide balance error (#59)
* Hide tooltip if error fetching balance * Remove unused import * Switch order of early return
1 parent 9993df6 commit a1420a2

File tree

1 file changed

+4
-10
lines changed

1 file changed

+4
-10
lines changed

src/components/WalletButton.tsx

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import { useState } from "react";
22
import {
3-
Alert,
43
Button,
54
Layout,
65
Modal,
@@ -28,6 +27,7 @@ export const WalletButton = () => {
2827

2928
const showTooltip = () => {
3029
void balance.updateBalance();
30+
if (balance.error) return;
3131
setIsTooltipVisible(true);
3232
};
3333

@@ -87,15 +87,9 @@ export const WalletButton = () => {
8787
/>
8888
}
8989
>
90-
{!balance.error ? (
91-
<span style={{ opacity: balance.isLoading ? 0.6 : 1 }}>
92-
{xlm} XLM
93-
</span>
94-
) : (
95-
<Alert variant="error" placement="inline">
96-
{balance.error?.message}
97-
</Alert>
98-
)}
90+
<span style={{ opacity: balance.isLoading ? 0.6 : 1 }}>
91+
{xlm} XLM
92+
</span>
9993
</Tooltip>
10094
</div>
10195
</Layout.Content>

0 commit comments

Comments
 (0)