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:
@ -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) {}
|
||||||
@ -483,7 +489,7 @@ window.clearAllIndicators = function() {
|
|||||||
});
|
});
|
||||||
activeIndicators = [];
|
activeIndicators = [];
|
||||||
configuringId = null;
|
configuringId = null;
|
||||||
renderIndicatorPanel();
|
renderIndicatorPanel();
|
||||||
drawIndicatorsOnChart();
|
drawIndicatorsOnChart();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user