Fix undefined Symbol
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -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]);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user