From 00aae46c167dd13969d782dbe3a96d822ae3d671 Mon Sep 17 00:00:00 2001 From: DiTus Date: Sun, 1 Mar 2026 22:49:05 +0100 Subject: [PATCH] fixed: preserve pane assignments across redraws instead of clearing --- .../dashboard/static/js/ui/indicators-panel-new.js | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/api/dashboard/static/js/ui/indicators-panel-new.js b/src/api/dashboard/static/js/ui/indicators-panel-new.js index d21ce99..0465fbf 100644 --- a/src/api/dashboard/static/js/ui/indicators-panel-new.js +++ b/src/api/dashboard/static/js/ui/indicators-panel-new.js @@ -887,8 +887,10 @@ export function drawIndicatorsOnChart() { 'dashed': LightweightCharts.LineStyle.Dashed }; - indicatorPanes.clear(); - nextPaneIndex = 1; + // Don't clear indicatorPanes - preserve pane assignments across redraws + // Only reset nextPaneIndex to avoid creating duplicate panes + const maxExistingPane = Math.max(...indicatorPanes.values(), 0); + nextPaneIndex = maxExistingPane + 1; const overlayIndicators = []; const paneIndicators = []; @@ -938,8 +940,12 @@ export function drawIndicatorsOnChart() { }); paneIndicators.forEach(({ indicator, meta, instance }, idx) => { - const paneIndex = nextPaneIndex++; - indicatorPanes.set(indicator.id, paneIndex); + // Use existing pane index if already assigned, otherwise create new one + let paneIndex = indicatorPanes.get(indicator.id); + if (paneIndex === undefined) { + paneIndex = nextPaneIndex++; + indicatorPanes.set(indicator.id, paneIndex); + } console.log(`[Indicators] Processing pane: ${indicator.name} (pane ${paneIndex})`); console.log(`[Indicators] Before renderIndicatorOnPane: indicator.cachedResults length = ${indicator.cachedResults?.length || 0}`);