Fix multi-timeframe analysis sync issues
- Ensure analysisInProgress flag is always reset in finally block - Remove duplicate concurrency flag resets from progress handlers - Fix inconsistent concurrency protection between single/multi timeframe - Prevents sync issues when selecting multiple timeframes for analysis
This commit is contained in:
@@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user