Add more diagnostic logging to track activeIndicators array lifecycle

- Log when module is loaded
- Log when setActiveIndicators is called
- Log when clearAllIndicators is called
- Show call stacks for debugging
This commit is contained in:
DiTus
2026-02-26 15:02:02 +01:00
parent bafaf524fe
commit aea7a4573e

View File

@ -1,5 +1,7 @@
import { getAvailableIndicators, IndicatorRegistry as IR } from '../indicators/index.js'; import { getAvailableIndicators, IndicatorRegistry as IR } from '../indicators/index.js';
console.log('[Module] indicators-panel-new.js loaded - activeIndicators count:', activeIndicators?.length || 0);
// State management // State management
let activeIndicators = []; let activeIndicators = [];
let configuringId = null; let configuringId = null;
@ -96,6 +98,8 @@ export function getActiveIndicators() {
} }
export function setActiveIndicators(indicators) { export function setActiveIndicators(indicators) {
console.warn('setActiveIndicators() called with', indicators.length, 'indicators - this will replace activeIndicators array!');
console.trace('Call stack:');
activeIndicators = indicators; activeIndicators = indicators;
renderIndicatorPanel(); renderIndicatorPanel();
} }
@ -476,6 +480,8 @@ window.updateIndicatorSetting = function(id, key, value) {
}; };
window.clearAllIndicators = function() { window.clearAllIndicators = function() {
console.warn('clearAllIndicators() called - clearing all indicators!');
console.trace('Call stack:');
activeIndicators.forEach(ind => { activeIndicators.forEach(ind => {
ind.series?.forEach(s => { ind.series?.forEach(s => {
try { window.dashboard?.chart?.removeSeries(s); } catch(e) {} try { window.dashboard?.chart?.removeSeries(s); } catch(e) {}