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:
@@ -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)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user