From 1e2f8ee72e08fab2e9d89c97fa71836980d0a525 Mon Sep 17 00:00:00 2001 From: spypsy Date: Thu, 23 Feb 2023 15:33:30 +0000 Subject: [PATCH] fix flickering pending tx page --- src/tx/index.tsx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/tx/index.tsx b/src/tx/index.tsx index 913af32..6ab6a96 100644 --- a/src/tx/index.tsx +++ b/src/tx/index.tsx @@ -46,6 +46,7 @@ interface TxProps { export const Tx: React.FunctionComponent = ({ id }) => { const [tx, setTx] = useState(); + const [initialised, setInitialised] = useState(false); const { get, response, loading, error } = useFetch(); @@ -56,7 +57,9 @@ export const Tx: React.FunctionComponent = ({ id }) => { // init useEffect(() => { - fetchTx(id).catch(() => `Error fetching tx details: ${id}`); + fetchTx(id) + .catch(() => `Error fetching tx details: ${id}`) + .finally(() => setInitialised(true)); }, []); useEffect(() => { @@ -89,7 +92,7 @@ export const Tx: React.FunctionComponent = ({ id }) => { const txTitleNode = ; - if (loading || !tx) { + if ((loading || !tx) && !initialised) { return (