From e36cb1f47e53f9a5770be4feeb87940043867fbb Mon Sep 17 00:00:00 2001 From: mindesbunister Date: Thu, 17 Jul 2025 15:40:48 +0200 Subject: [PATCH] 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 --- components/AIAnalysisPanel.tsx | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/components/AIAnalysisPanel.tsx b/components/AIAnalysisPanel.tsx index 50f379e..b238fba 100644 --- a/components/AIAnalysisPanel.tsx +++ b/components/AIAnalysisPanel.tsx @@ -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) - } } }