Skip to content

fix: improve message editing UX#153

Draft
shroominic wants to merge 4 commits intoalphafrom
fix/edit-message-ux-improvements
Draft

fix: improve message editing UX#153
shroominic wants to merge 4 commits intoalphafrom
fix/edit-message-ux-improvements

Conversation

@shroominic
Copy link
Contributor

Summary

This PR fixes several UX issues when editing messages and resubmitting:

Issues Fixed

  1. Stale responses shown during streaming - When editing a message and resubmitting, the old assistant response was still visible with the new thinking/streaming content appearing below it, causing confusion.

  2. Retry from error kept stale response - When clicking Retry on an error message, the incomplete assistant response that preceded the error was still shown.

  3. Independent version navigation on responses - When editing a user message, both the user message and response showed separate version navigators (e.g., both showing "2/2"), allowing them to be navigated independently. This was confusing because responses should follow their parent message's version.

Changes

  • ChatMessages.tsx:

    • Added logic to hide all messages after the last user message when streaming new content
    • Added getFilteredVersions to filter response versions based on the selected parent message
    • Updated version navigation to automatically switch responses when parent message version changes
    • Responses no longer show version navigator when there's only one response for the selected branch
  • useChatActions.ts:

    • When retrying from a system/error message, also removes the preceding assistant message

Result

  • When editing and resubmitting, only the user message is shown while streaming, with thinking/response appearing in place
  • Response versions are now linked to parent message versions (no independent navigation)
  • Switching between edited message versions automatically shows the corresponding response

- Hide stale assistant responses while streaming new content after edit
- Remove preceding assistant message when retrying from error
- Link response versions to parent message versions (no independent navigation)
- Automatically switch responses when navigating between edited message versions
@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Jan 24, 2026

Deploying routstr-chat with  Cloudflare Pages  Cloudflare Pages

Latest commit: 51aff65
Status: ✅  Deploy successful!
Preview URL: https://77e27172.routstr-chat.pages.dev
Branch Preview URL: https://fix-edit-message-ux-improvem.routstr-chat.pages.dev

View logs

- Previously, optimistic messages added synchronously lacked an event ID and were not updated, leading to 'phantom threads' and duplicates when the real message arrived.
- Now, 'createAndStoreChatEvent' adds the optimistic message synchronously (to prevent flash), and then UPDATES it in place when 'publishMessage' returns the real event ID.
- This ensures the message has a valid ID for version grouping and deduplication.
@shroominic shroominic requested a review from sh1ftred January 25, 2026 01:28
@shroominic shroominic marked this pull request as draft January 25, 2026 01:28
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.

Chat history edits should auto-switch branches when source changes

1 participant