diff --git a/explorer/src/components/TopAccountsCard.tsx b/explorer/src/components/TopAccountsCard.tsx
index 2d0d713a11..3880a1204f 100644
--- a/explorer/src/components/TopAccountsCard.tsx
+++ b/explorer/src/components/TopAccountsCard.tsx
@@ -19,19 +19,15 @@ export function TopAccountsCard() {
const [showDropdown, setDropdown] = React.useState(false);
const filter = useQueryFilter();
- // Fetch on load
- React.useEffect(() => {
- if (richList === Status.Idle && typeof supply === "object") fetchRichList();
- }, [supply]); // eslint-disable-line react-hooks/exhaustive-deps
-
if (typeof supply !== "object") return null;
if (richList === Status.Disconnected) {
return ;
}
- if (richList === Status.Idle || richList === Status.Connecting)
+ if (richList === Status.Connecting) {
return ;
+ }
if (typeof richList === "string") {
return ;
@@ -39,25 +35,28 @@ export function TopAccountsCard() {
let supplyCount: number;
let accounts, header;
- switch (filter) {
- case "nonCirculating": {
- accounts = richList.nonCirculating;
- supplyCount = supply.nonCirculating;
- header = "Non-Circulating";
- break;
- }
- case "all": {
- accounts = richList.total;
- supplyCount = supply.total;
- header = "Total";
- break;
- }
- case "circulating":
- default: {
- accounts = richList.circulating;
- supplyCount = supply.circulating;
- header = "Circulating";
- break;
+
+ if (richList !== Status.Idle) {
+ switch (filter) {
+ case "nonCirculating": {
+ accounts = richList.nonCirculating;
+ supplyCount = supply.nonCirculating;
+ header = "Non-Circulating";
+ break;
+ }
+ case "all": {
+ accounts = richList.total;
+ supplyCount = supply.total;
+ header = "Total";
+ break;
+ }
+ case "circulating":
+ default: {
+ accounts = richList.circulating;
+ supplyCount = supply.circulating;
+ header = "Circulating";
+ break;
+ }
}
}
@@ -84,23 +83,38 @@ export function TopAccountsCard() {
-
-
-
-
- Rank |
- Address |
- Balance (SOL) |
- % of {header} Supply |
-
-
-
- {accounts.map((account, index) =>
- renderAccountRow(account, index, supplyCount)
- )}
-
-
-
+ {richList === Status.Idle && (
+
+
+ Load Largest Accounts
+
+
+ )}
+
+ {accounts && (
+
+
+
+
+ Rank |
+ Address |
+ Balance (SOL) |
+
+ % of {header} Supply
+ |
+
+
+
+ {accounts.map((account, index) =>
+ renderAccountRow(account, index, supplyCount)
+ )}
+
+
+
+ )}
>
);