[PR #10373] fix(app): markdown rendering with morphdom for better dom functions #13421

Closed
opened 2026-02-16 18:18:16 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/anomalyco/opencode/pull/10373

State: closed
Merged: Yes


What does this PR do?

Fixes scroll jumping/flickering that occurred when streaming markdown content with code blocks.

Adam (@adamdotdevin) What I did is

  • Replace innerHTML with morphdom for incremental DOM updates
  • Configure morphdom to preserve copy button wrappers (data-component="markdown-code") and buttons (data-slot="markdown-copy-button")
  • Debounce setupCodeCopy() by 150ms so it only runs after content settles, not on every streaming update (for better ux uk)

Watch this videos for see the diff:

Issue:
Video: https://www.youtube.com/watch?v=rn7zQlxb1yU
(make sure you watch this video before 24 hours of pr created otherwise it will get deleted xD)

Solution:
Video: https://www.youtube.com/watch?v=B3NQV7KJp3o
(make sure you watch this video before 24 hours of pr created otherwise it will get deleted xD)

How did you verify your code works?

  • Tested streaming responses with multiple code blocks
  • Verified scroll follows content smoothly without jumping
  • Verified copy buttons appear and work correctly after streaming completes
  • Verified user scroll-up pauses auto-scroll, scroll-to-bottom resumes it

@adamdotdevin ready for merge!
solves issue: #10372

**Original Pull Request:** https://github.com/anomalyco/opencode/pull/10373 **State:** closed **Merged:** Yes --- ### What does this PR do? Fixes scroll jumping/flickering that occurred when streaming markdown content with code blocks. Adam (@adamdotdevin) What I did is - Replace `innerHTML` with `morphdom` for incremental DOM updates - Configure morphdom to preserve copy button wrappers (data-component="markdown-code") and buttons (data-slot="markdown-copy-button") - Debounce setupCodeCopy() by 150ms so it only runs after content settles, not on every streaming update (for better ux uk) Watch this videos for see the diff: Issue: Video: https://www.youtube.com/watch?v=rn7zQlxb1yU (make sure you watch this video before 24 hours of pr created otherwise it will get deleted xD) Solution: Video: https://www.youtube.com/watch?v=B3NQV7KJp3o (make sure you watch this video before 24 hours of pr created otherwise it will get deleted xD) - ### How did you verify your code works? - [x] Tested streaming responses with multiple code blocks - [x] Verified scroll follows content smoothly without jumping - [x] Verified copy buttons appear and work correctly after streaming completes - [x] Verified user scroll-up pauses auto-scroll, scroll-to-bottom resumes it @adamdotdevin ready for merge! solves issue: #10372
yindo added the pull-request label 2026-02-16 18:18:16 -05:00
yindo closed this issue 2026-02-16 18:18:16 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#13421