Add extensive diagnostic logging to track indicator array lifecycle

- Log initIndicatorPanel call stack
- Log addIndicator with array count changes
- Helps identify when/why activeIndicators gets cleared on TF switch
This commit is contained in:
DiTus
2026-02-26 15:04:57 +01:00
parent 437cd27bd9
commit b2fef0bd45

View File

@ -88,6 +88,8 @@ function groupPlotsByColor(plots) {
export function initIndicatorPanel() { export function initIndicatorPanel() {
console.log('[IndicatorPanel] Initializing...'); console.log('[IndicatorPanel] Initializing...');
console.log('[IndicatorPanel] Current activeIndicators count:', activeIndicators.length);
console.trace('[IndicatorPanel] initIndicatorPanel call stack:');
renderIndicatorPanel(); renderIndicatorPanel();
console.log('[IndicatorPanel] Initialized'); console.log('[IndicatorPanel] Initialized');
} }
@ -626,6 +628,9 @@ function addIndicator(type) {
params[input.name] = input.default; params[input.name] = input.default;
}); });
console.log(`[addIndicator] Adding ${id} to array, current count: ${activeIndicators.length}`);
console.trace('Call stack:');
activeIndicators.push({ activeIndicators.push({
id, id,
type, type,
@ -635,6 +640,9 @@ function addIndicator(type) {
series: [], series: [],
visible: true visible: true
}); });
console.log(`[addIndicator] After push, array count: ${activeIndicators.length}`);
// Don't set configuringId so indicators are NOT expanded by default // Don't set configuringId so indicators are NOT expanded by default
renderIndicatorPanel(); renderIndicatorPanel();
drawIndicatorsOnChart(); drawIndicatorsOnChart();