Skip to content
This repository has been archived by the owner on Jun 24, 2022. It is now read-only.

Fix for investment amount reset when you go back #2247

Merged
merged 1 commit into from
Jan 21, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions src/custom/pages/Claim/InvestmentFlow/InvestOption.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,16 @@ export default function InvestOption({ approveData, claim, optionIndex }: Invest
}
}, [balance, isSelfClaiming, maxCost, setMaxAmount])

// this will set input and percentage value if you go back from the review page
useEffect(() => {
const { investmentCost } = calculateInvestmentAmounts(claim, investedAmount)

if (investmentCost) {
onInputChange(investmentCost?.toExact())
}
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [])

return (
<InvestTokenGroup>
<div>
Expand Down