Conversation
Add a copy button to chat messages, matching the copy-to-clipboard affordance in Claude/ChatGPT-style chat UIs. Assistant replies get the button merged into the existing feedback row (next to the thumbs up/down); user messages get a standalone row. What: - Reuse the existing copyTextToClipboard helper (lib/clipboard.ts) and notify toast for success/failure feedback. - Hide the button while an assistant reply is still streaming, since the displayed text can change before an in-flight clipboard write resolves. - Guard the post-await state updates with a mounted ref so a clipboard write that resolves after the component unmounts (e.g. switching sessions mid-copy) does not touch state or leave a dangling timer; the ref is reset on effect setup (not just cleared on cleanup) so it survives React StrictMode's dev-mode double mount/unmount cycle. - Reset the "copied" confirmation timer via a ref on every click so a repeated click before the first window expires gets its own full 1.5s confirmation instead of being cut short by the earlier timer. Testing: - frontend-enterprise: npx tsc -b (clean) - frontend-enterprise: npx vitest run src/pages/chat (64 passed)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Chat messages had no way to copy their text, unlike the copy-to-clipboard affordance under each message in Claude/ChatGPT-style chat UIs. This adds that button to both user and assistant messages in the chat page.
Changes
MessageBubble: merged into the existing feedback row (next to thumbs up/down) for assistant replies, and a standalone row for user messages. Reuses the existingcopyTextToClipboardhelper andnotifytoast for success/failure feedback.Testing
cd frontend-enterprise && npx tsc -b— cleancd frontend-enterprise && npx vitest run src/pages/chat— 64 passedRisks
No obvious risks. Change is scoped to a single component (
MessageBubble.tsx) and its test file; no API, schema, or config changes.