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:
aleka
2023-10-24 17:06:00 -04:00
committed by GitHub
parent 575856b77b
commit 3fd71558c0
3 changed files with 6 additions and 6 deletions
+2 -2
View File
@@ -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 };
};