File tree Expand file tree Collapse file tree 1 file changed +7
-0
lines changed
src/features/tradeview/ui/StockChart Expand file tree Collapse file tree 1 file changed +7
-0
lines changed Original file line number Diff line number Diff line change @@ -39,6 +39,7 @@ export default function Chart({ ticker = 'BTC', count = 30 }: ChartProps) {
3939 const [ isChartReady , setIsChartReady ] = useState ( false ) ;
4040 const realTimeData = useRealTimeData ( ticker ) ;
4141 const pastTimeData = usePastTimeData ( ticker , selectedInterval , count ) ;
42+ const prevRequestDate = useRef < Time | null > ( null ) ;
4243
4344 const chartOption : DeepPartial < TimeChartOptions > = useMemo ( ( ) => {
4445 return {
@@ -89,6 +90,12 @@ export default function Chart({ ticker = 'BTC', count = 30 }: ChartProps) {
8990 if ( logicalRange . from < - 0.5 ) {
9091 const firstData = seriesRef . current ?. dataByIndex ( 0 ) as CandlestickData ;
9192 if ( ! firstData || ! firstData . time ) return ;
93+ if (
94+ prevRequestDate . current &&
95+ prevRequestDate . current <= firstData . time
96+ )
97+ return ;
98+ prevRequestDate . current = firstData . time ;
9299
93100 const firstDate = timestampToISOString ( firstData . time as number ) ;
94101
You can’t perform that action at this time.
0 commit comments