From d170a2b8655c1eb9d5d238151ddefe62e62b91b3 Mon Sep 17 00:00:00 2001 From: Thomas Jeatt Date: Thu, 27 Apr 2023 10:48:27 +0100 Subject: [PATCH 1/3] fix: use currentBlokNumber when there is no existing stake --- src/pages/Staking/index.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/pages/Staking/index.tsx b/src/pages/Staking/index.tsx index 820f011322..ac3342ce12 100644 --- a/src/pages/Staking/index.tsx +++ b/src/pages/Staking/index.tsx @@ -325,7 +325,8 @@ const Staking = (): JSX.Element => { if (!stakedAmountAndEndBlock) return; const lockTimeValue = Number(lockTime); - const extensionTime = stakedAmountAndEndBlock.endBlock + convertWeeksToBlockNumbers(lockTimeValue); + const extensionTime = + stakedAmountAndEndBlock.endBlock || currentBlockNumber + convertWeeksToBlockNumbers(lockTimeValue); setBlockLockTimeExtension(extensionTime); }, [currentBlockNumber, lockTime, stakedAmountAndEndBlock]); From 27d78e26e1806fd08769dea360edf6449b93f407 Mon Sep 17 00:00:00 2001 From: Thomas Jeatt Date: Thu, 27 Apr 2023 11:18:18 +0100 Subject: [PATCH 2/3] fix: correct condition --- src/pages/Staking/index.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pages/Staking/index.tsx b/src/pages/Staking/index.tsx index ac3342ce12..13e84307d5 100644 --- a/src/pages/Staking/index.tsx +++ b/src/pages/Staking/index.tsx @@ -322,11 +322,11 @@ const Staking = (): JSX.Element => { React.useEffect(() => { if (!lockTime) return; if (!currentBlockNumber) return; - if (!stakedAmountAndEndBlock) return; const lockTimeValue = Number(lockTime); + const extensionTime = - stakedAmountAndEndBlock.endBlock || currentBlockNumber + convertWeeksToBlockNumbers(lockTimeValue); + (stakedAmountAndEndBlock?.endBlock || currentBlockNumber) + convertWeeksToBlockNumbers(lockTimeValue); setBlockLockTimeExtension(extensionTime); }, [currentBlockNumber, lockTime, stakedAmountAndEndBlock]); From 942bbc71fab46bea8c200b96689c2d2785784c57 Mon Sep 17 00:00:00 2001 From: Thomas Jeatt Date: Thu, 27 Apr 2023 11:19:10 +0100 Subject: [PATCH 3/3] chore: whitespace --- src/pages/Staking/index.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/src/pages/Staking/index.tsx b/src/pages/Staking/index.tsx index 13e84307d5..c95bbb604b 100644 --- a/src/pages/Staking/index.tsx +++ b/src/pages/Staking/index.tsx @@ -324,7 +324,6 @@ const Staking = (): JSX.Element => { if (!currentBlockNumber) return; const lockTimeValue = Number(lockTime); - const extensionTime = (stakedAmountAndEndBlock?.endBlock || currentBlockNumber) + convertWeeksToBlockNumbers(lockTimeValue);