fix trading view error (#96)
* fix trading view error * only init trading view if market id is first defined, and nits re fills table with empty asset
This commit is contained in:
parent
575856b77b
commit
3fd71558c0
@ -44,7 +44,7 @@ export const useTradingView = ({
|
||||
const hasMarkets = marketIds.length > 0;
|
||||
|
||||
useEffect(() => {
|
||||
if (hasMarkets && isClientConnected) {
|
||||
if (hasMarkets && isClientConnected && marketId) {
|
||||
const widgetOptions = getWidgetOptions();
|
||||
const widgetOverrides = getWidgetOverrides(appTheme);
|
||||
const options = {
|
||||
@ -75,7 +75,7 @@ export const useTradingView = ({
|
||||
tvWidgetRef.current = null;
|
||||
setIsChartReady(false);
|
||||
};
|
||||
}, [getCandlesForDatafeed, isClientConnected, hasMarkets, selectedLocale, selectedNetwork]);
|
||||
}, [getCandlesForDatafeed, isClientConnected, hasMarkets, selectedLocale, selectedNetwork, !!marketId]);
|
||||
|
||||
return { savedResolution };
|
||||
};
|
||||
|
||||
@ -107,8 +107,8 @@ export const getHydratedTradingData = ({
|
||||
perpetualMarkets?: Record<string, PerpetualMarket>;
|
||||
}) => ({
|
||||
...data,
|
||||
asset: assets && perpetualMarkets && assets[perpetualMarkets[data.marketId].assetId],
|
||||
stepSizeDecimals: perpetualMarkets?.[data.marketId].configs?.stepSizeDecimals,
|
||||
tickSizeDecimals: perpetualMarkets?.[data.marketId].configs?.tickSizeDecimals,
|
||||
asset: assets && perpetualMarkets && assets[perpetualMarkets[data.marketId]?.assetId],
|
||||
stepSizeDecimals: perpetualMarkets?.[data.marketId]?.configs?.stepSizeDecimals,
|
||||
tickSizeDecimals: perpetualMarkets?.[data.marketId]?.configs?.tickSizeDecimals,
|
||||
...('side' in data && { orderSide: convertAbacusOrderSide(data.side) }),
|
||||
});
|
||||
|
||||
@ -161,7 +161,7 @@ const getFillsTableColumnDef = ({
|
||||
}[orderSide],
|
||||
})}
|
||||
</Styled.Side>
|
||||
<Output type={OutputType.Text} value={asset.id} />
|
||||
<Output type={OutputType.Text} value={asset?.id} />
|
||||
</Styled.TableCell>
|
||||
),
|
||||
},
|
||||
|
||||
Loading…
Reference in New Issue
Block a user