전략분봉 저장 에러 문제 수정

This commit is contained in:
Macbook
2026-05-23 21:08:46 +09:00
parent eaf067db1c
commit 70ac67afe7
18 changed files with 2445 additions and 498 deletions
+19 -1
View File
@@ -281,9 +281,9 @@ export class ChartManager {
this.indicators.clear();
this.patternMarkers = [];
this._disposeMainMarkersPlugin();
if (this.mainSeries) { try { this.chart.removeSeries(this.mainSeries); } catch { /* ok */ } this.mainSeries = null; }
if (this.volumeSeries) { try { this.chart.removeSeries(this.volumeSeries); } catch { /* ok */ } this.volumeSeries = null; }
this.mainMarkersPlugin = null;
this.mainSeries = this._createMainSeries(chartType, t);
const mainData = bars.map(b => {
@@ -586,6 +586,13 @@ export class ChartManager {
this._notifyPaneLayout();
}
/** 메인 시리즈 마커 플러그인 해제 (setData 등 시리즈 교체 전 호출) */
private _disposeMainMarkersPlugin(): void {
if (!this.mainMarkersPlugin) return;
try { this.mainMarkersPlugin.detach(); } catch { /* ok */ }
this.mainMarkersPlugin = null;
}
private _reapplyAllPatternMarkers(): void {
if (!this.mainSeries) return;
const patternAll = this.patternMarkers.flatMap(({ markers }) =>
@@ -612,6 +619,15 @@ export class ChartManager {
text: m.text,
}));
const all = [...patternAll, ...backtestAll, ...liveAll];
if (this.mainMarkersPlugin) {
try {
if (this.mainMarkersPlugin.getSeries() !== this.mainSeries) {
this._disposeMainMarkersPlugin();
}
} catch {
this._disposeMainMarkersPlugin();
}
}
if (!this.mainMarkersPlugin) {
this.mainMarkersPlugin = createSeriesMarkers(this.mainSeries, all);
} else {
@@ -648,6 +664,8 @@ export class ChartManager {
text,
};
});
// 시리즈 교체·detach 이후 stale 플러그인 방지 — 백테스트 마커는 항상 재생성
this._disposeMainMarkersPlugin();
this._reapplyAllPatternMarkers();
}