-
Notifications
You must be signed in to change notification settings - Fork 5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fixed currency-display #5619
fixed currency-display #5619
Conversation
* call getValueFromWeiHex() with fromCurrency=nativeCurrency
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.
@hackmod can you provide more detail about why/where this is needed? If anything we could pass fromCurrency: currency
, no?
I can confirm that the minimal fix is the following with clean setup,. so strange.. --- a/ui/app/components/currency-display/currency-display.container.js
+++ b/ui/app/components/currency-display/currency-display.container.js
@@ -24,7 +24,7 @@ const mergeProps = (stateProps, dispatchProps, ownProps) => {
const toCurrency = currency || currentCurrency
const convertedValue = getValueFromWeiHex({
- value, toCurrency, conversionRate, numberOfDecimals, toDenomination: denomination,
+ value, fromCurrency: 'ETH', toCurrency, conversionRate, numberOfDecimals, toDenomination: denomination,
})
const displayValue = formatCurrency(convertedValue, toCurrency)
const suffix = hideLabel ? undefined : toCurrency.toUpperCase() screenshotwith this fixwithout this fix |
@@ -16,6 +17,7 @@ const mergeProps = (stateProps, dispatchProps, ownProps) => { | |||
const { | |||
value, | |||
numberOfDecimals = 2, | |||
nativeCurrency = ETH, |
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.
We can pull this from state above (in mapStateToProps
) and then we shouldn't need a default
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.
yes. as you already mentioned and logically we don't have to apply this fix at all.
but as you can see, without this fix, currency-display do not show the correct value...
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.
drop last change
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.
last change seems no effect and formal fix looks redundant but it show correct value.
as you already pointed out fromCurrency: currency
might be work logically but for currency == undefined
case, currency-input show wrong value.
@@ -95,6 +95,7 @@ export default class CurrencyInput extends PureComponent { | |||
return ( | |||
<CurrencyDisplay | |||
className="currency-input__conversion-component" | |||
nativeCurrency={nativeCurrency} |
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 noted above, we can pull this from state
b9404c2
to
cb37bbf
Compare
Thanks |
partial revert commit 99acde4
getValueFromWeiHex()
withfromCurrency=nativeCurrency