Skip to content

Preserve message content when chat send fails#605

Merged
jon-bell merged 1 commit intostagingfrom
claude/preserve-failed-messages-zsw9C
Jan 31, 2026
Merged

Preserve message content when chat send fails#605
jon-bell merged 1 commit intostagingfrom
claude/preserve-failed-messages-zsw9C

Conversation

@jon-bell
Copy link
Contributor

@jon-bell jon-bell commented Jan 31, 2026

When users try to send a message while disconnected from the chat,
the message was being cleared even though it failed to send. This was
because handleSendMessage returned early without throwing an error,
so the .then() block in MessageInput executed and cleared the input.

Now handleSendMessage throws an error when not connected, which is
caught by MessageInput's error handler, preserving the user's message
in the input box so they don't lose their typed content.

https://claude.ai/code/session_012EqUZa3tCdhg3hHkBQkDdg

Summary by CodeRabbit

  • Bug Fixes
    • Improved error handling in real-time chat for disconnected states.

✏️ Tip: You can customize this high-level summary in your review settings.

When users try to send a message while disconnected from the chat,
the message was being cleared even though it failed to send. This was
because handleSendMessage returned early without throwing an error,
so the .then() block in MessageInput executed and cleared the input.

Now handleSendMessage throws an error when not connected, which is
caught by MessageInput's error handler, preserving the user's message
in the input box so they don't lose their typed content.

https://claude.ai/code/session_012EqUZa3tCdhg3hHkBQkDdg
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 31, 2026

Walkthrough

The handleSendMessage function in the realtime chat component was modified to throw a standard Error when the connection is unavailable, replacing the previous toaster error notification and early return pattern.

Changes

Cohort / File(s) Summary
Error Handling Update
components/realtime-chat.tsx
Changed the not-connected error path from displaying a toaster notification with early return to throwing a standard Error exception.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

A message unent takes a different road,
Where errors now throw what they're owed,
Toast once popped, now silence falls,
The exception answers when the connection stalls. ✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Preserve message content when chat send fails' accurately captures the main objective of the PR, which is to prevent users from losing typed messages when the chat send operation fails.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch claude/preserve-failed-messages-zsw9C

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@argos-ci
Copy link

argos-ci bot commented Jan 31, 2026

The latest updates on your projects. Learn more about Argos notifications ↗︎

Build Status Details Updated (UTC)
default (Inspect) ⚠️ Changes detected (Review) 70 changed Jan 31, 2026, 5:18 PM

@jon-bell jon-bell merged commit 074eaae into staging Jan 31, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants