Add diagnostic logging to track indicator array lifecycle during TF switch
- Log when drawIndicatorsOnChart starts and completes - Log activeIndicators count at various stages - Add call stack logging to identify who's calling functions - Detect case where module is being reloaded or array is being cleared
This commit is contained in:
@ -799,11 +799,14 @@ export function drawIndicatorsOnChart() {
|
||||
|
||||
console.log(`drawIndicatorsOnChart called: interval=${currentInterval}, candles=${candles?.length || 0}, activeIndicators=${activeIndicators.length}`);
|
||||
console.log('Active indicators visibility:', activeIndicators.map(i => ({id: i.id, visible: i.visible})));
|
||||
console.trace('[drawIndicatorsOnChart] Call stack:');
|
||||
|
||||
if (!candles || candles.length === 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
console.log('[drawIndicatorsOnChart] Removing series complete, remaining indicators:', activeIndicators.length);
|
||||
|
||||
// First, remove all existing series
|
||||
activeIndicators.forEach(ind => {
|
||||
ind.series?.forEach(s => {
|
||||
@ -812,6 +815,8 @@ export function drawIndicatorsOnChart() {
|
||||
ind.series = [];
|
||||
});
|
||||
|
||||
console.log('[drawIndicatorsOnChart] Series arrays cleared, indicator count:', activeIndicators.length);
|
||||
|
||||
const lineStyleMap = {
|
||||
'solid': LightweightCharts.LineStyle.Solid,
|
||||
'dotted': LightweightCharts.LineStyle.Dotted,
|
||||
|
||||
@ -1,5 +1,8 @@
|
||||
import { getAvailableIndicators, IndicatorRegistry as IR } from '../indicators/index.js';
|
||||
|
||||
console.warn('⚠️ [indicators-panel.js] OLD MODULE DETECTED! This will conflict with indicators-panel-new.js!');
|
||||
console.trace('[indicators-panel.js] Loading call stack:');
|
||||
|
||||
let activeIndicators = [];
|
||||
let configuringId = null;
|
||||
let previewingType = null; // type being previewed (not yet added)
|
||||
|
||||
Reference in New Issue
Block a user