fix: clear claudeStatus and resync writer on WebSocket reconnect#570
fix: clear claudeStatus and resync writer on WebSocket reconnect#570netrezver wants to merge 1 commit intositeboon:mainfrom
Conversation
handleWebSocketReconnect was missing two things: 1. setClaudeStatus(null) — stale "Processing" status persisted after reconnect, keeping the thinking indicator visible indefinitely 2. check-session-status — without it, the server writer stays bound to the dead WebSocket; the `complete` event is then silently dropped (WebSocketWriter.send is a no-op when readyState != OPEN), leaving isLoading stuck at true Fix: clear claudeStatus and send check-session-status on reconnect so the server rebinds the writer and the indicator clears correctly. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThis change modifies the WebSocket reconnect handler to clear Changes
Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment Tip You can validate your CodeRabbit configuration file in your editor.If your editor has YAML language server, you can enable auto-completion and validation by adding |
Problem
The thinking/processing indicator sometimes stays stuck after the response is complete. The user has to click Stop Generation to dismiss it.
Root Cause
handleWebSocketReconnectinsrc/components/chat/view/ChatInterface.tsxhas two bugs:1. Missing
setClaudeStatus(null)When a message is sent,
setClaudeStatus({ text: 'Processing', ... })is called. On WebSocket reconnect,handleWebSocketReconnectcallssetIsLoading(false)but never clearsclaudeStatus. SinceClaudeStatusrenders wheneverisLoading || statusis truthy, the indicator stays visible indefinitely with a stale status.2. No
check-session-statuson reconnectWebSocketWriter.send()silently drops messages whenreadyState !== OPEN:If the connection drops after the last message but before
completeis delivered,completeis lost. On reconnect,handleWebSocketReconnectdoes not sendcheck-session-status, so the server never callsreconnectSessionWriter— the writer stays bound to the dead WebSocket andcompletekeeps getting dropped on any retry.Fix
Send
check-session-statuson reconnect so the server rebinds the writer to the new WebSocket, and clearclaudeStatusso no stale status persists.const handleWebSocketReconnect = useCallback(async () => { if (!selectedProject || !selectedSession) return; const providerVal = (localStorage.getItem('selected-provider') as SessionProvider) || 'claude'; await sessionStore.refreshFromServer(selectedSession.id, { provider: (selectedSession.__provider || providerVal) as SessionProvider, projectName: selectedProject.name, projectPath: selectedProject.fullPath || selectedProject.path || '', }); setIsLoading(false); setCanAbortSession(false); + setClaudeStatus(null); + if (sendMessage) { + sendMessage({ type: 'check-session-status', sessionId: selectedSession.id, provider: providerVal }); + } - }, [selectedProject, selectedSession, sessionStore, setIsLoading, setCanAbortSession]); + }, [selectedProject, selectedSession, sessionStore, setIsLoading, setCanAbortSession, setClaudeStatus, sendMessage]);Summary by CodeRabbit