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:
DiTus
2026-02-26 15:08:30 +01:00
parent b2fef0bd45
commit 2769814b64
2 changed files with 8 additions and 0 deletions

View File

@ -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,