Skip to content

Commit

Permalink
Merge pull request #815 from near/fix/status-widget-data
Browse files Browse the repository at this point in the history
fix: match data format change in QueryApi contract, extra error handling
  • Loading branch information
charleslavon authored May 21, 2024
2 parents a20187a + 831b8be commit 8170ea1
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/Entities/QueryApi/DataPlatformIndexerStatuses.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,15 @@ const registry = Near.view(registryContract, "list_indexer_functions", {
account_id: indexerAccount,
});

if (errors && (!registry || !indexerList)) {
return <div>{errors ? JSON.stringify(errors) : null}</div>;
}

if (!registry) {
return <div>Loading indexer list from contract...</div>;
} else {
try {
const keys = Object.keys(registry["Account"]);
const keys = Object.keys(registry["AccountIndexers"]);
const sanitizedIndexerNames = keys.map((k) => k.replace(/[^a-zA-Z0-9]/g, "_").replace(/^([0-9])/, "_$1"));

setIndexerList(sanitizedIndexerNames);
Expand Down Expand Up @@ -117,7 +121,7 @@ const update = () => {
}
};

if (!timer) {
if (registry && !timer) {
update();
setTimer(setInterval(update, 1000));
}
Expand Down

0 comments on commit 8170ea1

Please sign in to comment.