From 144bd36674cd6247e09a8608b2276a8fd60e3c62 Mon Sep 17 00:00:00 2001 From: Justin Starry Date: Thu, 29 Oct 2020 10:36:48 +0800 Subject: [PATCH] Explorer: fix confirmed block refetch (#13261) --- explorer/src/providers/block.tsx | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/explorer/src/providers/block.tsx b/explorer/src/providers/block.tsx index 1427acde53..c1bf178dc3 100644 --- a/explorer/src/providers/block.tsx +++ b/explorer/src/providers/block.tsx @@ -64,13 +64,9 @@ export async function fetchBlock( key, url, }); - let status = FetchStatus.Fetching; - let data: ConfirmedBlock = { - blockhash: "", - previousBlockhash: "", - parentSlot: 0, - transactions: [], - }; + + let status: FetchStatus; + let data: ConfirmedBlock | undefined; try { const connection = new Connection(url, "max"); @@ -103,12 +99,7 @@ export function useFetchBlock() { } return React.useCallback( - (key: number) => { - const entry = state.entries[key]; - if (!entry) { - fetchBlock(dispatch, url, cluster, key); - } - }, - [state, dispatch, cluster, url] + (key: number) => fetchBlock(dispatch, url, cluster, key), + [dispatch, cluster, url] ); }