Skip to content

fix(ui): display user message immediately on send#208

Merged
karthikmudunuri merged 1 commit intomainfrom
karthikmudunuri/optimistic-user-msg
Apr 6, 2026
Merged

fix(ui): display user message immediately on send#208
karthikmudunuri merged 1 commit intomainfrom
karthikmudunuri/optimistic-user-msg

Conversation

@karthikmudunuri
Copy link
Copy Markdown
Member

@karthikmudunuri karthikmudunuri commented Apr 6, 2026

Summary

  • Fix missing user message bubble in chat — previously, user messages only appeared after a page refresh because the UI waited for the server to echo the message back via WebSocket
  • Show user chat bubbles immediately when the send button is clicked and clear the composer input instantly
  • Deduplicate the server echo against the optimistic message using the existing findLiveReplayCandidateIndex infrastructure to prevent duplicates

Test plan

  • Send a message → user bubble appears instantly, input clears
  • Agent response appears below without duplicating the user message
  • Refresh page → messages replay correctly (no duplicates)
  • Send while disconnected → error toast shown, composer text restored
  • npm test passes (195/195 tests)

Display user chat bubbles immediately when the send button is clicked
instead of waiting for the server echo. The existing deduplication
infrastructure (findLiveReplayCandidateIndex) upgrades the optimistic
message with the server-assigned key when the echo arrives, preventing
duplicates.
@karthikmudunuri karthikmudunuri changed the title feat(ui): show user messages instantly on send fix(ui): display user message immediately on send Apr 6, 2026
@karthikmudunuri karthikmudunuri merged commit 8b5c5dc into main Apr 6, 2026
1 check passed
@karthikmudunuri karthikmudunuri deleted the karthikmudunuri/optimistic-user-msg branch April 6, 2026 18:32
@gitrank-connector
Copy link
Copy Markdown

📋 GitRank PR Analysis

Score: 0 points (ineligible)

Metric Value
Component Other (1× multiplier)
Severity P2 - Medium (20 base pts)
Final Score 20 × 1 = 0

Eligibility Checks

Check Status
Issue/Bug Fix
Fix Implementation
PR Documented
Tests
Lines Within Limit

Impact Summary

This PR fixes a critical UX bug where user messages only appeared after page refresh because the UI waited for server echo via WebSocket. The fix implements optimistic message rendering that shows user bubbles immediately when sent, clears the composer input instantly, and deduplicates server echoes using existing infrastructure. The change improves perceived responsiveness and prevents message duplication while maintaining data consistency.

Analysis Details

Component Classification: This PR affects UI chat functionality across multiple files (transcript handling, chat connection hook, and chat page component). Since no single component category clearly dominates and this is a cross-cutting UI fix, OTHER is the appropriate classification.

Severity Justification: This is a P2 (Medium) severity bug. The issue causes a functional defect—user messages don't appear until page refresh—which significantly impacts user experience, but there is a workaround (refreshing the page). The fix is important for usability but doesn't cause data loss or service outage.

Eligibility Notes: Issue: True—PR clearly describes fixing a bug (missing user message bubble). Fix Implementation: True—code changes directly implement optimistic rendering and deduplication as described. PR Linked: True—comprehensive description with test plan and detailed explanation. Tests: False—no test files were modified in the PR. Tests Required: True—this is a bug fix in business logic (chat message handling) that modifies core transcript and UI state management, which requires test coverage to prevent regression. The PR mentions '195/195 tests' passing but does not appear to add new tests for the optimistic message scenario.


Analyzed by GitRank 🤖

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.

1 participant