Skip to content

fix(dekstop): when streaming markdown with code blocks, scroll jumped erratically. #10372

Closed

Description

@ProdigyRahul

Description

when streaming markdown with code blocks, scroll jumped erratically.
found the cause: setupCodeCopy() ran on every render, wrapping <pre> blocks with <div data-component="markdown-code"> + copy buttons. these wrappers weren't in the HTML
output, so on next render the DOM was completely replaced via innerHTML, destroying wrappers, then setupCodeCopy re-added them. This cycle caused layout thrashing → scroll jumping.

Issue Video:
https://jumpshare.com/s/zb0Mn1orq7Wgw5NTaJcQ

Plugins

No response

OpenCode version

1.1.34

Steps to reproduce

No response

Screenshot and/or share link

https://jumpshare.com/s/zb0Mn1orq7Wgw5NTaJcQ

Operating System

macOS Tahoe 26.2

Terminal

No response

Activity

  1. added
    perfIndicates a performance issue or need for optimization
    webRelates to opencode on web / desktop
    on Jan 24, 2026
  2. github-actions commented on Jan 24, 2026

    @github-actions
    Contributor

    While there are related scroll/rendering issues in the repository (#9886 for disruptive auto-scroll behavior, #6172 for high CPU during streaming), this issue appears to have a distinct root cause related to the setupCodeCopy() function being called on every render and causing DOM replacement via innerHTML. The related issues have different underlying causes and solutions, so this is likely not a duplicate. However, it's worth noting these exist as they may interact with each other's fixes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingperfIndicates a performance issue or need for optimizationwebRelates to opencode on web / desktop

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions