Skip to content

Commit

Permalink
Fix Est Account Value
Browse files Browse the repository at this point in the history
Fix busyorg#2207

First try cryptosPriceHistory and then feed rate.
  • Loading branch information
economicstudio committed Jul 19, 2019
1 parent 233d585 commit 639f643
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/client/user/UserWallet.js
Expand Up @@ -21,6 +21,7 @@ import {
getLoadingMoreUsersAccountHistory,
getUserHasMoreAccountHistory,
getCryptosPriceHistory,
getRate,
} from '../reducers';
import {
getGlobalProperties,
Expand Down Expand Up @@ -51,6 +52,7 @@ import { getAccount } from './usersActions';
: getUser(state, ownProps.match.params.name).name,
),
cryptosPriceHistory: getCryptosPriceHistory(state),
rate: getRate(state),
}),
{
getGlobalProperties,
Expand Down Expand Up @@ -78,6 +80,7 @@ class Wallet extends Component {
userHasMoreActions: PropTypes.bool.isRequired,
isCurrentUser: PropTypes.bool,
authenticatedUserName: PropTypes.string,
rate: PropTypes.number.isRequired,
};

static defaultProps = {
Expand Down Expand Up @@ -123,6 +126,7 @@ class Wallet extends Component {
userHasMoreActions,
usersAccountHistory,
cryptosPriceHistory,
rate,
} = this.props;
const userKey = getUserDetailsKey(user.name);
const transactions = _.get(usersTransactions, userKey, []);
Expand All @@ -137,7 +141,11 @@ class Wallet extends Component {
`${SBD.symbol}.priceDetails.currentUSDPrice`,
null,
);
const steemRateLoading = _.isNull(currentSteemRate) || _.isNull(currentSBDRate);
// cryptosPriceHistory doesn't support SBD prices anymore.
// But just in case it may support again, try it first and then use feed rate.
const steemRateLoading =
_.isNull(currentSteemRate) || (_.isNull(currentSBDRate) && _.isNull(rate));
const sbdRate = currentSBDRate || rate;

return (
<div>
Expand All @@ -148,7 +156,7 @@ class Wallet extends Component {
totalVestingFundSteem={totalVestingFundSteem}
loadingGlobalProperties={loadingGlobalProperties}
steemRate={currentSteemRate}
sbdRate={currentSBDRate}
sbdRate={sbdRate}
steemRateLoading={steemRateLoading}
/>
{transactions.length === 0 && usersAccountHistoryLoading ? (
Expand Down

0 comments on commit 639f643

Please sign in to comment.