diff --git a/components/AIAnalysisPanel.tsx b/components/AIAnalysisPanel.tsx index cbe9641..5fca6c3 100644 --- a/components/AIAnalysisPanel.tsx +++ b/components/AIAnalysisPanel.tsx @@ -126,7 +126,6 @@ export default function AIAnalysisPanel({ onAnalysisComplete }: AIAnalysisPanelP setEventSource(null) // Reset UI state when analysis completes setLoading(false) - analysisInProgress.current = false setProgress(null) } else if (progressData.type === 'connected') { console.log(`🔍 EventSource connected for ${sessionId}`) @@ -142,7 +141,6 @@ export default function AIAnalysisPanel({ onAnalysisComplete }: AIAnalysisPanelP console.log(`🔍 All steps completed for ${sessionId}, resetting UI state`) setTimeout(() => { setLoading(false) - analysisInProgress.current = false setProgress(null) es.close() setEventSource(null) @@ -378,7 +376,6 @@ export default function AIAnalysisPanel({ onAnalysisComplete }: AIAnalysisPanelP // Reset loading state immediately on error setLoading(false) - analysisInProgress.current = false setProgress(null) // Mark current active step as error @@ -398,11 +395,11 @@ export default function AIAnalysisPanel({ onAnalysisComplete }: AIAnalysisPanelP return prev }) } finally { - // Only reset loading for multi-timeframe analysis + // Always reset concurrency flag, but only reset loading for multi-timeframe analysis // Single timeframe analysis loading state is managed by progress tracking + analysisInProgress.current = false if (analysisTimeframes.length > 1) { setLoading(false) - analysisInProgress.current = false } } }