Skip to content

Commit

Permalink
Fix ConvertAssets
Browse files Browse the repository at this point in the history
  • Loading branch information
1aerostorm committed Aug 17, 2023
1 parent 070e0a0 commit 98785e1
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions app/components/elements/market/MarketPair.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,10 @@ class MarketPair extends React.Component {
makeItem = (asset, depths, maxDepth) => {
let pct = 0
const dd = depths[asset.symbol]
if (dd.market_usd) {
// TODO: dd can be undefined, because when we switching symbols,
// PagedDropdownMenu re-renders on old symbols (it caches them),
// but with new depths.
if (dd && dd.market_usd) {
pct = dd.market_usd / maxDepth * 100
// coefficients
pct = Math.min(100, pct * 6)
Expand All @@ -142,7 +145,7 @@ class MarketPair extends React.Component {
'background': 'linear-gradient(to left, white ' + (100 - Math.round(pct)) + '%, ' + highlightColor + ' 1%)',
},
dataset: {
market_usd: dd.market_usd
market_usd: dd && dd.market_usd
}
}
}
Expand Down

0 comments on commit 98785e1

Please sign in to comment.