From 98785e1ea69eb49db4afbad9a08cf57fbc1064d2 Mon Sep 17 00:00:00 2001 From: 1aerostorm Date: Thu, 17 Aug 2023 13:56:38 +0000 Subject: [PATCH] Fix ConvertAssets --- app/components/elements/market/MarketPair.jsx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/app/components/elements/market/MarketPair.jsx b/app/components/elements/market/MarketPair.jsx index 49039b5..c8e63b7 100644 --- a/app/components/elements/market/MarketPair.jsx +++ b/app/components/elements/market/MarketPair.jsx @@ -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) @@ -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 } } }