-
Notifications
You must be signed in to change notification settings - Fork 54
Conversation
|
src/custom/state/claim/actions.ts
Outdated
// investing | ||
setIsInvestFlowActive: (payload: boolean) => void | ||
setInvestFlowStep: (payload: number) => void | ||
initInvestFlowData: (payload: EnhancedUserClaimData[]) => void |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dont save complex shapes to redux state, it's unoptimised, and we can't debug them in redux dev tools.
in this case EnhancedUserClaimData
is:
type EnhancedUserClaimData = UserClaimData & {
currencyAmount?: CurrencyAmount<Token | GpEther> | undefined
claimAmount?: CurrencyAmount<Token> | undefined
price?: Price<Currency, Currency> | undefined
cost?: CurrencyAmount<Currency> | undefined
isFree: boolean
}
do we really need all of that? if not only save what we need and only save the string representations of what we need. i realy dont know if we do need this in state tho...
happy to hear otherwise
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated with simple redux data structure with just index
and investAmount
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My biggest concern with this PR is that it looks like duplicates the work Protofire did #2060
Why not using https://pr2060--gpswapui.review.gnosisdev.com/#/profile ?
@nenadV91 Committed a small merge conflict fix, involving the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approved, although mainly to get it merged and be able to reiterate
setPercentage(value) | ||
}, | ||
[balance, maxCost, optionIndex, updateInvestAmount] | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
as we discussed yesterday, we won't need this (unles u want it for set max amount), which i guess would be overkill
@@ -194,7 +209,7 @@ export default function InvestOption({ approveData, updateInvestAmount, claim }: | |||
<input | |||
// disabled | |||
placeholder="0" | |||
value={investedAmount} | |||
value={investedAmount ? formatUnits(investedAmount, decimals) : '0'} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shouldn't this field be handled if it changes?
It can be done in another PR
updateInvestAmount(claim.index, investAmount) | ||
}, [balance, claim.index, maxCost, updateInvestAmount]) | ||
updateInvestAmount({ index: optionIndex, amount: amount.quotient.toString() }) | ||
setPercentage(INVESTMENT_STEPS[INVESTMENT_STEPS.length - 1]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what a elaborate way to just set the percentage to 100%
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hehe that's my bad :P we did this together on the call
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Summary