Streaming Without Jank: Render Storms, Incremental Markdown, and Scroll Anchoring
Models emit dozens to hundreds of deltas per second, and the naive approach re-renders React on every one of them while dragging down the input the user is typing into. Work through render storms, incomplete Markdown, and stolen scroll position so streaming stays smooth even in long sessions.
Models emit dozens to hundreds of deltas per second, and the naive approach re-renders React on every one of them while dragging down the input the user is typing into. Work through render storms, incomplete Markdown, and stolen scroll position so streaming stays smooth even in long sessions.
Interview questions
A model is emitting 80 deltas per second, your chat page drops frames, and the input box lags. In what order do you diagnose and fix it?模型每秒吐 80 个增量,你的聊天页开始掉帧、输入框也变卡,你按什么顺序排查和优化?
Common in ChinaCommon overseasDeep dive#react-performance#streaming#profiling🔒 Unlock this chapter to see the answer keys.
Your streaming Markdown renderer receives a code fence that has opened but not yet closed. How should it handle that?流式 Markdown 渲染到一半,代码块的围栏只来了一半,你的渲染器应该怎么处理?
Common in ChinaCommon overseasIntermediate#markdown#streaming#rendering🔒 Unlock this chapter to see the answer keys.
When should a chat message list auto-scroll to the bottom, and when should it not? State your rule.聊天消息列表什么时候该自动滚到底部,什么时候不该?说出你的判定规则。
Common in ChinaCommon overseasBasic#scroll-behavior#ux#chat-ui🔒 Unlock this chapter to see the answer keys.
Your streaming chat never janks locally but users report lag in production. What could explain that?你的流式聊天在本地怎么测都不卡,一上线用户就抱怨界面卡顿。可能是什么原因?
Common in ChinaCommon overseasDeep dive#react-performance#testing#debugging🔒 Unlock this chapter to see the answer keys.
