전략조건 상세설명 기능 추가
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import React, { useRef, useEffect, useState, useCallback } from 'react';
|
||||
import React, { useRef, useEffect, useLayoutEffect, useState, useCallback } from 'react';
|
||||
import type { MouseEventParams, Time } from 'lightweight-charts';
|
||||
import type { OHLCVBar, ChartType, Theme, IndicatorConfig, LegendData, Drawing, ChartMode, Timeframe } from '../types';
|
||||
import { ChartManager } from '../utils/ChartManager';
|
||||
@@ -139,6 +139,8 @@ const TradingChart: React.FC<TradingChartProps> = ({
|
||||
onSeriesDoubleClickRef.current = onSeriesDoubleClick;
|
||||
const marketRef = useRef(market);
|
||||
marketRef.current = market;
|
||||
const barsMarketRef = useRef(barsMarket);
|
||||
barsMarketRef.current = barsMarket;
|
||||
|
||||
const [ctxMenu, setCtxMenu] = useState<{
|
||||
x: number; y: number; price: number;
|
||||
@@ -165,8 +167,17 @@ const TradingChart: React.FC<TradingChartProps> = ({
|
||||
const [candleOnlyMode, setCandleOnlyMode] = useState(false);
|
||||
|
||||
useEffect(() => {
|
||||
barsRef.current = bars;
|
||||
}, [bars]);
|
||||
const ready = barsMarket == null
|
||||
? false
|
||||
: barsMarket === undefined
|
||||
? true
|
||||
: barsMarket === market;
|
||||
if (ready) {
|
||||
barsRef.current = bars;
|
||||
} else if (barsMarket != null && barsMarket !== market) {
|
||||
barsRef.current = [];
|
||||
}
|
||||
}, [bars, barsMarket, market]);
|
||||
|
||||
useEffect(() => {
|
||||
indicatorsRef.current = indicators;
|
||||
@@ -687,13 +698,16 @@ const TradingChart: React.FC<TradingChartProps> = ({
|
||||
// 컨테이너가 처음으로 유효한 크기를 가질 때:
|
||||
// 데이터가 이미 barsRef에 있지만 차트에 아직 세팅되지 않은 경우 (예: 멀티레이아웃 초기 렌더) 재로드
|
||||
if (barsRef.current.length > 0 && !m.hasMainSeries()) {
|
||||
reloadAll(
|
||||
const bm = barsMarketRef.current;
|
||||
if (bm != null && bm !== marketRef.current) return;
|
||||
if (marketRef.current.startsWith('KRW-') && barsRef.current.length < MIN_BARS_FOR_FULL_RELOAD) return;
|
||||
void reloadAll(
|
||||
m,
|
||||
barsRef.current,
|
||||
prevChartType.current,
|
||||
prevTheme.current,
|
||||
prevLogScale.current,
|
||||
[] // indicators는 별도 useEffect에서 처리
|
||||
indicatorsRef.current,
|
||||
);
|
||||
} else {
|
||||
applyPaneLayout(m);
|
||||
@@ -746,6 +760,7 @@ const TradingChart: React.FC<TradingChartProps> = ({
|
||||
prevMarketTf.current = timeframe;
|
||||
prevBarsKey.current = '';
|
||||
prevIndKey.current = '';
|
||||
barsRef.current = [];
|
||||
reloadRetryRef.current = 0;
|
||||
reloadGenRef.current += 1;
|
||||
reloadSafetyTimers.current.forEach(clearTimeout);
|
||||
|
||||
Reference in New Issue
Block a user