Improve chat responsiveness during streamed code output (#2987)
### Motivation
- Prevent the UI from becoming sluggish while the assistant streams
large or rapidly-updated messages by deferring expensive
markdown/custom-tag parsing during active streaming.
### Description
- Use React's `useDeferredValue` in `DyadMarkdownParser` and switch the
parser to consume a `contentToParse` value that is the deferred
`content` only while `isStreaming` is true, and update the `useMemo`
dependency to `contentToParse` so final rendering uses the full, current
content.
### Testing
- Ran `npm run fmt`, `npm run lint`, and `npm run ts` in this
environment, and all three failed due to the npm registry returning `403
Forbidden` for required tooling (formatter/linter/typechecker) rather
than code errors in the change.
------
[Codex
Task](https://chatgpt.com/codex/tasks/task_e_69b10fad1e74832782eea5db1ccb0196)
<!-- devin-review-badge-begin -->
---
<a href="https://app.devin.ai/review/dyad-sh/dyad/pull/2987"
target="_blank">
<picture>
<source media="(prefers-color-scheme: dark)"
srcset="https://static.devin.ai/assets/gh-open-in-devin-review-dark.svg?v=1">
<img
src="https://static.devin.ai/assets/gh-open-in-devin-review-light.svg?v=1"
alt="Open with Devin">
</picture>
</a>
<!-- devin-review-badge-end -->
正在显示
请
注册
或者
登录
后发表评论