Explorer: fix confirmed block refetch (#13261)
This commit is contained in:
@ -64,13 +64,9 @@ export async function fetchBlock(
|
|||||||
key,
|
key,
|
||||||
url,
|
url,
|
||||||
});
|
});
|
||||||
let status = FetchStatus.Fetching;
|
|
||||||
let data: ConfirmedBlock = {
|
let status: FetchStatus;
|
||||||
blockhash: "",
|
let data: ConfirmedBlock | undefined;
|
||||||
previousBlockhash: "",
|
|
||||||
parentSlot: 0,
|
|
||||||
transactions: [],
|
|
||||||
};
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const connection = new Connection(url, "max");
|
const connection = new Connection(url, "max");
|
||||||
@ -103,12 +99,7 @@ export function useFetchBlock() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return React.useCallback(
|
return React.useCallback(
|
||||||
(key: number) => {
|
(key: number) => fetchBlock(dispatch, url, cluster, key),
|
||||||
const entry = state.entries[key];
|
[dispatch, cluster, url]
|
||||||
if (!entry) {
|
|
||||||
fetchBlock(dispatch, url, cluster, key);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
[state, dispatch, cluster, url]
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user