Fix undefined Symbol

This commit is contained in:
jaredvu
2023-08-29 15:38:15 -07:00
parent 9bbd8d30ed
commit 76100c9857
2 changed files with 3 additions and 7 deletions
+2 -6
View File
@@ -1,6 +1,5 @@
import { useEffect } from 'react';
import { shallowEqual, useSelector } from 'react-redux';
import { useLocation } from 'react-router-dom';
import isEmpty from 'lodash/isEmpty';
import { LanguageCode, ResolutionString, widget } from 'public/tradingview/charting_library';
@@ -14,9 +13,8 @@ import { store } from '@/state/_store';
import { getSelectedNetwork } from '@/state/appSelectors';
import { getAppTheme } from '@/state/configsSelectors';
import { getSelectedLocale } from '@/state/localizationSelectors';
import { getMarketIds } from '@/state/perpetualsSelectors';
import { getCurrentMarketId, getMarketIds } from '@/state/perpetualsSelectors';
import { getMarketIdFromLocation } from '@/lib/tradeData';
import { getDydxDatafeed } from '@/lib/tradingView/dydxfeed';
import { getSavedResolution, getWidgetOptions, getWidgetOverrides } from '@/lib/tradingView/utils';
@@ -30,8 +28,7 @@ export const useTradingView = ({
tvWidgetRef: React.MutableRefObject<any>;
setIsChartReady: React.Dispatch<React.SetStateAction<boolean>>;
}) => {
const location = useLocation();
const marketId = getMarketIdFromLocation(location);
const marketId = useSelector(getCurrentMarketId);
const appTheme = useSelector(getAppTheme);
const marketIds = useSelector(getMarketIds, shallowEqual);
const selectedLocale = useSelector(getSelectedLocale);
@@ -50,7 +47,6 @@ export const useTradingView = ({
if (hasMarkets) {
const widgetOptions = getWidgetOptions();
const widgetOverrides = getWidgetOverrides(appTheme);
console.log(marketId);
const options = {
// debug: true,
...widgetOptions,
+1 -1
View File
@@ -29,7 +29,7 @@ export const useCurrentMarketId = () => {
const validId = useMemo(() => {
if (marketIds.length === 0) return marketId ?? lastViewedMarket;
if (!marketIds.includes(marketId)) return DEFAULT_MARKETID;
if (!marketIds.includes(marketId ?? lastViewedMarket)) return DEFAULT_MARKETID;
return marketId ?? lastViewedMarket;
}, [marketIds, marketId]);