실시간 차트 보조지표명 겹침오류 수정

This commit is contained in:
Macbook
2026-05-29 01:59:55 +09:00
parent 3db7e85e2c
commit db1c22d217
4 changed files with 302 additions and 142 deletions
+10 -3
View File
@@ -221,6 +221,7 @@ const TradingChart: React.FC<TradingChartProps> = ({
const prevSortedPKRef = useRef<string>(''); // 순서 무관 paramKey (reorder 감지용)
const prevIndicatorsListRef = useRef<IndicatorConfig[]>(indicators);
const indicatorSyncInFlightRef = useRef(false);
const [paneLegendPaused, setPaneLegendPaused] = useState(false);
const pendingIndicatorResyncRef = useRef(false);
const indicatorReloadGenRef = useRef(0);
const prevMarket = useRef<string>(market);
@@ -1176,15 +1177,19 @@ const TradingChart: React.FC<TradingChartProps> = ({
const savedLR = mgr.getVisibleLogicalRange();
const syncGen = ++indicatorReloadGenRef.current;
indicatorSyncInFlightRef.current = true;
void mgr.refreshIndicators(paramsChangedConfigs).then(() => {
setPaneLegendPaused(true);
void mgr.refreshIndicatorParamsInPlace(paramsChangedConfigs).then(() => {
if (syncGen !== indicatorReloadGenRef.current) {
indicatorSyncInFlightRef.current = false;
setPaneLegendPaused(false);
return;
}
afterIndicatorPaneMutation(mgr);
mgr.notifyPaneLayoutChanged();
restoreLogicalRange(mgr, savedLR);
syncIndicatorTrackingRefs(indicators);
indicatorSyncInFlightRef.current = false;
setPaneLegendPaused(false);
flushPendingIndicatorResync(mgr, syncGen);
});
} else if (isReorderOnly) {
@@ -1401,8 +1406,10 @@ const TradingChart: React.FC<TradingChartProps> = ({
)}
{chartMgr && !candleOnlyMode && showPaneLegend && (
<PaneLegendPortal
key={indKey(indicators)}
manager={chartMgr}
indicators={indicators}
paused={paneLegendPaused}
getContainer={() => containerRef.current}
onHoverName={(id, sx, sy) => onHoverPaneLegend?.(id, sx, sy)}
onLeaveName={() => onLeavePaneLegend?.()}
@@ -1487,7 +1494,7 @@ const CandlePaneControlsPortal: React.FC<{
// ── containerEl 을 안전하게 주입하는 래퍼 ───────────────────────────────────
const PaneLegendPortal: React.FC<
Omit<PaneLegendProps, 'containerEl'> & { getContainer: () => HTMLElement | null }
> = ({ getContainer, ...rest }) => {
> = ({ getContainer, paused, ...rest }) => {
const [el, setEl] = useState<HTMLElement | null>(null);
useEffect(() => {
@@ -1501,7 +1508,7 @@ const PaneLegendPortal: React.FC<
}, []);
if (!el) return null;
return <PaneLegend {...rest} containerEl={el} />;
return <PaneLegend {...rest} containerEl={el} paused={paused} />;
};
// ── 변경 감지용 키 생성 헬퍼 ────────────────────────────────────────────────