From b0c31441c45da9da63a72044474b321d11f08a30 Mon Sep 17 00:00:00 2001 From: Willian Mitsuda Date: Mon, 31 Jan 2022 16:35:34 -0300 Subject: [PATCH] Simplify logic --- src/AddressTransactionByNonce.tsx | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/src/AddressTransactionByNonce.tsx b/src/AddressTransactionByNonce.tsx index 9e1763b..d752138 100644 --- a/src/AddressTransactionByNonce.tsx +++ b/src/AddressTransactionByNonce.tsx @@ -26,7 +26,12 @@ const AddressTransactionByNonce: React.FC = ({ ); const navigate = useNavigate(); - if (checksummedAddress !== undefined && isNaN(nonce)) { + if (checksummedAddress === undefined) { + return ; + } + + // Garbage nonce + if (isNaN(nonce)) { return ( = ({ ); } - if (checksummedAddress !== undefined && !isNaN(nonce) && txHash === null) { + + // Valid nonce, but no tx found + if (!txHash) { return ( = ({ ); } - if (txHash) { - navigate(transactionURL(txHash), { replace: true }); - } + + // Success; replace and render filler + navigate(transactionURL(txHash), { replace: true }); return ; };