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)
|
setEventSource(null)
|
||||||
// Reset UI state when analysis completes
|
// Reset UI state when analysis completes
|
||||||
setLoading(false)
|
setLoading(false)
|
||||||
analysisInProgress.current = false
|
|
||||||
setProgress(null)
|
setProgress(null)
|
||||||
} else if (progressData.type === 'connected') {
|
} else if (progressData.type === 'connected') {
|
||||||
console.log(`🔍 EventSource connected for ${sessionId}`)
|
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`)
|
console.log(`🔍 All steps completed for ${sessionId}, resetting UI state`)
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
setLoading(false)
|
setLoading(false)
|
||||||
analysisInProgress.current = false
|
|
||||||
setProgress(null)
|
setProgress(null)
|
||||||
es.close()
|
es.close()
|
||||||
setEventSource(null)
|
setEventSource(null)
|
||||||
@@ -378,7 +376,6 @@ export default function AIAnalysisPanel({ onAnalysisComplete }: AIAnalysisPanelP
|
|||||||
|
|
||||||
// Reset loading state immediately on error
|
// Reset loading state immediately on error
|
||||||
setLoading(false)
|
setLoading(false)
|
||||||
analysisInProgress.current = false
|
|
||||||
setProgress(null)
|
setProgress(null)
|
||||||
|
|
||||||
// Mark current active step as error
|
// Mark current active step as error
|
||||||
@@ -398,11 +395,11 @@ export default function AIAnalysisPanel({ onAnalysisComplete }: AIAnalysisPanelP
|
|||||||
return prev
|
return prev
|
||||||
})
|
})
|
||||||
} finally {
|
} 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
|
// Single timeframe analysis loading state is managed by progress tracking
|
||||||
|
analysisInProgress.current = false
|
||||||
if (analysisTimeframes.length > 1) {
|
if (analysisTimeframes.length > 1) {
|
||||||
setLoading(false)
|
setLoading(false)
|
||||||
analysisInProgress.current = false
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user