Skip to content

Commit

Permalink
Refactor ManageStaking component's useEffect hooks
Browse files Browse the repository at this point in the history
  • Loading branch information
shibatales committed Feb 7, 2024
1 parent dd509bc commit 41a82cd
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions src/modals/ManageStaking.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -420,11 +420,9 @@ const ManageStaking = (props: { isOpen: boolean; }) => {
}, [coreStakedBalance, altBalance, metadata, stakeForm, numericCoreStakedBalance]);

useEffect(() => {
console.log('selectedCoreInfo initialCore', selectedCoreInfo, selectedCore);
if (selectedCoreInfo && selectedCore && selectedCoreInfo?.name !== selectedCore.key.toString()) {
setAltBalance(true);

console.log('selectedCoreInfo?.userStaked', selectedCoreInfo?.userStaked);
if (selectedCoreInfo?.userStaked) {
const stakedBalance = formatBalanceSafely(selectedCoreInfo?.userStaked?.toString());
setCoreStakedBalance(stakedBalance);
Expand All @@ -434,7 +432,7 @@ const ManageStaking = (props: { isOpen: boolean; }) => {

setAltBalance(false);
setCoreStakedBalance("0");
}, [selectedCoreInfo, selectedCore, metadata, availableBalance, altBalance]);
}, [selectedCoreInfo, selectedCore, metadata, availableBalance]);

useEffect(() => {
if (altBalance) {
Expand Down

0 comments on commit 41a82cd

Please sign in to comment.