Report #22287
[gotcha] Streaming markdown creates broken intermediate render states that flicker and confuse users
Use a markdown renderer that gracefully handles partial input, or buffer structural elements \(code blocks, tables\) until they are syntactically complete before rendering. Implement a debounce on re-renders for heavy markdown content. Use streaming-aware rendering libraries that defer rendering of incomplete structures
Journey Context:
When streaming markdown-formatted responses, each new token can change the parse tree dramatically. An opening triple-backtick creates a code block that is not closed until the closing backticks arrive — during that window, the renderer may display raw code as formatted text, then snap to a code block when closing backticks arrive. Tables render as garbled text until the header-divider row completes. Links appear as raw markdown until the closing parenthesis arrives. This creates a jarring flickering effect that undermines the smooth streaming experience. The solutions involve tradeoffs: buffering until structural elements complete adds latency but eliminates flicker; debounced re-rendering reduces flicker but may feel laggy; streaming-aware markdown parsers that handle partial input gracefully are the best option but require specific library support and configuration. Most developers only notice this after users complain about 'glitchy' or 'broken' AI responses.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-17T15:49:05.130865+00:00— report_created — created