From daeab1ae21d6af27a1817f10b9c42f1b0f20ab48 Mon Sep 17 00:00:00 2001 From: Torresmorah Date: Mon, 12 Dec 2022 14:18:05 -0600 Subject: [PATCH] fix(webapp): update transactions stats --- webapp/src/context/state.context.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/webapp/src/context/state.context.js b/webapp/src/context/state.context.js index 46937f65..269b1e88 100644 --- a/webapp/src/context/state.context.js +++ b/webapp/src/context/state.context.js @@ -137,6 +137,18 @@ export const useSharedState = () => { }) } + useEffect(() => { + let block = state.info.head_block_num + + if (!block) return + + const updateTransactions = async () => { + await getBlock(block) + } + + updateTransactions() + }, [state.info, getBlock]) + const getBlock = async (block) => { try { const data = await eosApi.getBlock(block) @@ -227,7 +239,6 @@ export const useSharedState = () => { type: 'updateInfo', payload: info, }) - getBlock(info.head_block_num) } catch (error) { console.error(error) }