Repository navigation
Conversation
Walkthrough
Priority: Severity of issue fixed: Low Merge Risk:
|
There was a problem hiding this comment.
Actionable comments posted: 2
ℹ️ Review info
⚙️ Run configuration
- Source mode: Auto
- Repository: Unavailable
- Branch: Unavailable
- File: No configuration file from this repository applied
- Commit: Unavailable
- Layers: Repository UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
bb9e3ba9-7b9d-445c-afb8-d03b37dedcc5
📒 Files selected for processing: 8
mobile/src/components/MobileMarkdown.file-links.test.tsmobile/src/components/MobileMarkdown.rendering.test.tsxmobile/src/components/mobile-markdown-android-selection.test.tsxmobile/src/components/mobile-markdown-blocks.tsxmobile/src/components/mobile-markdown-mermaid-routing.test.tsmobile/src/components/mobile-markdown-selectable.test.tsxmobile/src/components/mobile-markdown-styles.tsmobile/src/components/mobile-markdown-table.test.tsx
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.
…chat does Desktop chat shows copy on a Mermaid fence while it is still code and drops it only when the diagram replaces the block.
…ocks don't grow an empty header
There was a problem hiding this comment.
Actionable comments posted: 1

Review info
-
Run configuration-
- Source mode: Auto
- Repository: Unavailable
- Branch: Unavailable
- File: No configuration file from this repository applied
- Commit: Unavailable
- Layers: Repository UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
7c41da03-32dc-4e4a-ab07-6abe92fc9275
Files selected for processing: 5-
mobile/src/components/MobileMarkdown.rendering.test.tsxmobile/src/components/mobile-markdown-android-selection.test.tsxmobile/src/components/mobile-markdown-blocks.tsxmobile/src/components/mobile-markdown-mermaid-routing.test.tsmobile/src/components/mobile-markdown-styles.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.
-
| {node.value} | ||
| </MarkdownText> | ||
| </View> | ||
| {node.value ? ( |
There was a problem hiding this comment.
Keep the copy button off Mermaid fences.
When a non-empty Mermaid fence is still growing, renderCode skips the diagram branch and reaches this condition. The copy button then appears during streaming, despite the intended Mermaid exclusion. Exclude Mermaid languages from this condition.
Proposed fix
-
--- "a/mobile/src/components/mobile-markdown-blocks.tsx" +++ "b/mobile/src/components/mobile-markdown-blocks.tsx" @@ -64,7 +64,7 @@ {node.value} </MarkdownText> </View> - {node.value ? ( + {node.value && !isMobileMermaidLanguage(node.lang ?? undefined) ? ( <MobileSourceCopyButton text={node.value} accessibilityLabel="Copy code" /> ) : null} </View>
Committable suggestion
-
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.Suggested change{node.value ? ( {node.value && !isMobileMermaidLanguage(node.lang ?? undefined) ? (
|
Thanks for adding per-code-block copy on mobile, @radut, and for following through on the layout and Mermaid cases. Your work is now on main through #34039, including the copy button beside each block and the compact layout from this PR. I’m closing this one because the contribution is already included. Thank you! |
ELI5
Code blocks in the mobile chat now have their own copy button, so you can grab just the command instead of the whole reply.
What Changed
Before: the only copy button on mobile chat copied the whole message.
After: each code block shows a small copy button next to its language label, and it copies only that block. It reuses
MobileSourceCopyButton, so the feedback and error handling match the message copy. Mermaid fences don't get one, since they turn into diagrams.Why
Copying one command out of a long reply on a phone meant copying everything and trimming it by hand. Desktop markdown preview already has a per-block copy button.
Linked Issue
Fixes #32280
Visual Proof
Chat code blocks with the language label and copy button, on an iPhone:
Testing
New rendering tests: each block copies only its own code, and a streaming mermaid fence gets no button. Mobile vitest, typecheck, oxlint and oxfmt pass.
AI Disclosure
Drafted with Claude Code, reviewed and tested by me.
Review
Agent skill upstream boundary
Notes
Mobile only, no desktop, SSH or platform-specific code touched.
Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)Maintainer changes
The "after" shots are this branch on an iPhone 18 Pro simulator, iOS 27, in a react-native-web harness. iOS builds draw chat in that web page. Tapping copy on the first block put exactly
pnpm test --filter mobileon the clipboard, and the second putgit push -u origin my-branch.Tap, check mark, back to the copy icon after 1.5s:
after-copy.mp4
Linear: STA-11848. Copy for shell commands that the app detects outside code fences is tracked separately in #32773.