fix: Progress window not disappearing after analysis completion

- Clear loading and progress state immediately after successful analysis
- Remove dependency on progress tracking EventSource for UI state reset
- Ensure progress window disappears for both single and batch analysis
- Simplify state management by handling completion explicitly in performAnalysis
- Fix user experience issue where progress window remained stuck
This commit is contained in:
mindesbunister
2025-07-17 15:40:48 +02:00
parent 47d7b8b364
commit e36cb1f47e

View File

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