diff --git a/components/AIAnalysisPanel.tsx b/components/AIAnalysisPanel.tsx index 50f379e..b238fba 100644 --- a/components/AIAnalysisPanel.tsx +++ b/components/AIAnalysisPanel.tsx @@ -299,9 +299,9 @@ export default function AIAnalysisPanel({ onAnalysisComplete }: AIAnalysisPanelP setResult(data) - // For single timeframe analysis, don't set loading to false yet - // Let the progress tracking handle UI state reset - console.log(`🔍 API call completed for ${sessionId}, progress tracking will handle UI reset`) + // Clear loading and progress state after successful single timeframe analysis + setLoading(false) + setProgress(null) // Call the callback with analysis result if provided if (onAnalysisComplete && data.analysis) { @@ -359,6 +359,10 @@ export default function AIAnalysisPanel({ onAnalysisComplete }: AIAnalysisPanelP setResult(multiResult) + // Clear loading and progress state after successful batch analysis + setLoading(false) + setProgress(null) + // Call the callback with analysis result if provided if (onAnalysisComplete && data.analysis) { onAnalysisComplete(data.analysis, analysisSymbol) @@ -389,12 +393,8 @@ export default function AIAnalysisPanel({ onAnalysisComplete }: AIAnalysisPanelP return prev }) } finally { - // Always reset concurrency flag, but only reset loading for multi-timeframe analysis - // Single timeframe analysis loading state is managed by progress tracking + // Always reset concurrency flag analysisInProgress.current = false - if (analysisTimeframes.length > 1) { - setLoading(false) - } } }