dont recreate TV chart on every mkt change
This commit is contained in:
parent
23dfb1235e
commit
c5080c6132
|
@ -88,9 +88,10 @@ const TradingViewChart = () => {
|
|||
const selectedMarketName = mangoStore((s) => s.selectedMarket.current?.name)
|
||||
const isMobile = width ? width < breakpoints.sm : false
|
||||
|
||||
const defaultProps = useMemo(
|
||||
() => ({
|
||||
symbol: selectedMarketName,
|
||||
const defaultProps = useMemo(() => {
|
||||
const initialMktName = mangoStore.getState().selectedMarket.current?.name
|
||||
return {
|
||||
symbol: initialMktName,
|
||||
interval: '60' as ResolutionString,
|
||||
theme: 'Dark',
|
||||
container: 'tv_chart_container',
|
||||
|
@ -105,9 +106,8 @@ const TradingViewChart = () => {
|
|||
'volume.volume.color.1': COLORS.UP[theme],
|
||||
'volume.precision': 4,
|
||||
},
|
||||
}),
|
||||
[theme, selectedMarketName]
|
||||
)
|
||||
}
|
||||
}, [theme])
|
||||
|
||||
const tvWidgetRef = useRef<IChartingLibraryWidget>()
|
||||
const orderLinesButtonRef = useRef<HTMLElement>()
|
||||
|
|
|
@ -328,7 +328,7 @@ const mangoStore = create<MangoStore>()(
|
|||
details: { profile_name: '', trader_category: '', wallet_pk: '' },
|
||||
},
|
||||
selectedMarket: {
|
||||
name: '',
|
||||
name: 'SOL/USDC',
|
||||
current: undefined,
|
||||
fills: [],
|
||||
bidsAccount: undefined,
|
||||
|
|
Loading…
Reference in New Issue