fix trading view flashing when changing markets

This commit is contained in:
Tyler Shipe 2021-12-01 00:00:09 -05:00
parent b9c8dd09d5
commit eb81b20e3f
1 changed files with 11 additions and 1 deletions

View File

@ -80,6 +80,16 @@ const TVChartContainer = () => {
const tvWidgetRef = useRef<IChartingLibraryWidget | null>(null) const tvWidgetRef = useRef<IChartingLibraryWidget | null>(null)
useEffect(() => {
if (tvWidgetRef.current) {
tvWidgetRef.current.setSymbol(
selectedMarketConfig.name,
defaultProps.interval,
() => {}
)
}
}, [selectedMarketConfig.name])
useEffect(() => { useEffect(() => {
const widgetOptions: ChartingLibraryWidgetOptions = { const widgetOptions: ChartingLibraryWidgetOptions = {
symbol: selectedMarketConfig.name, symbol: selectedMarketConfig.name,
@ -178,7 +188,7 @@ const TVChartContainer = () => {
}) })
}) })
//eslint-disable-next-line //eslint-disable-next-line
}, [selectedMarketConfig, theme, isMobile]) }, [theme, isMobile])
const handleCancelOrder = async ( const handleCancelOrder = async (
order: Order | PerpOrder | PerpTriggerOrder, order: Order | PerpOrder | PerpTriggerOrder,