Skip to content

Multiple code blocks not rendering in Copilot Chat until window reload #305560

@simeonwong2000

Description

@simeonwong2000

Description:
When asking Copilot Chat to provide multiple code blocks in a single response, only the last code block (or no code blocks) displays initially. All code blocks appear correctly only after reloading the chat window.

Steps to Reproduce:

  1. Open Copilot Chat in VS Code
  2. Ask Copilot for multiple code examples, e.g.: "Can you show me some code block? anything code is fine"
  3. Request multiple code samples in different languages (JavaScript, TypeScript, Python, etc.)
  4. Observe the initial response

Expected Behavior:
All code blocks should render and display properly in the chat message on first load, without requiring a window reload.

Actual Behavior:

  • Initial load: Only the last code block visible (or all code blocks are hidden)
  • After window reload (F5 or browser refresh): All code blocks display correctly
  • The code blocks exist in the DOM after reload, confirming they were sent by the server

Screenshots/Evidence:

  • Before reload: Only 1 code block visible (or none)
  • After reload: All 5+ code blocks visible as expected

System Information:

  • OS: Windows 11
  • VS Code Version: 1.113.0
  • Copilot Extension Version: 0.41.1
  • Model: Claude Haiku 4.5

Reproduction:
Consistently reproducible - happens every time multiple code blocks are requested in one response.

Workaround:
Reload the VS Code window (F5) or refresh the chat to display all code blocks.

Root Cause Analysis (likely):

  • Client-side rendering/lazy-loading issue
  • Code blocks in DOM but not displayed initially
  • Probable JavaScript initialization or component mounting issue in chat UI
  • Not a server/backend issue (content is received correctly)

Suggested Investigation:

  • Check chat component rendering lifecycle
  • Verify code block component mounting on initial render
  • Check for race conditions in markdown parsing or syntax highlighting

Metadata

Metadata

Assignees

Labels

*duplicateIssue identified as a duplicate of another issue(s)

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions