From 38dd5f6e88c41ff4102134393e0764dabfeab7a6 Mon Sep 17 00:00:00 2001 From: mulan xia Date: Thu, 8 Feb 2024 11:38:52 -0500 Subject: [PATCH] fix order --- src/views/charts/TvChart.tsx | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/views/charts/TvChart.tsx b/src/views/charts/TvChart.tsx index 6f67d44..7fb8df6 100644 --- a/src/views/charts/TvChart.tsx +++ b/src/views/charts/TvChart.tsx @@ -76,6 +76,19 @@ export const TvChart = () => { tvWidget?.activeChart().setVisibleRange(newRange, { percentRightMargin: 10 }); }; + /** + * @description Hook to handle changing chart resolution + */ + useEffect(() => { + if (chartResolution) { + if (chartResolution !== selectedResolution) { + dispatch(setTvChartResolution({ marketId: currentMarketId, resolution: chartResolution })); + } + + setVisibleRangeForResolution({ resolution: chartResolution }); + } + }, [chartResolution]); + /** * @description Hook to handle changing markets */ @@ -191,19 +204,6 @@ export const TvChart = () => { orderLines = {}; }; - /** - * @description Hook to handle changing chart resolution - */ - useEffect(() => { - if (chartResolution) { - if (chartResolution !== selectedResolution) { - dispatch(setTvChartResolution({ marketId: currentMarketId, resolution: chartResolution })); - } - - setVisibleRangeForResolution({ resolution: chartResolution }); - } - }, [chartResolution]); - return ( {!isChartReady && }