Background
#18525 fixed useChat throttling so a configured throttle limits the message snapshots published to React. Before that fix, throttling only delayed the subscription callback; unrelated React renders could still observe the latest chat.messages array for every stream chunk and bypass the configured cadence.
The fix intentionally preserved the current default: when throttle is omitted, message snapshots remain unthrottled. Applications therefore need to know that they should opt into throttling to avoid excessive React work during fast, high-frequency streams. This is particularly noticeable on slower devices or when rendering expensive content such as Markdown, tool calls, or context menus, as reported in #6166.
Changing the omitted default affects observable rendering behavior and is therefore appropriate for the next major release.
Goal (v8)
Use a 50ms publication cadence for useChat message snapshots when throttle is omitted, while preserving an explicit unthrottled opt-out:
throttle value |
Behavior |
| omitted |
Publish React message snapshots at a 50ms cadence |
0 |
Publish every message snapshot without throttling |
| positive number |
Publish at the configured cadence |
Stream processing, tool handling, and callbacks should remain immediate. Only snapshots exposed to React should be paced.
The default cadence must include an immediate leading publication and a terminal flush so the final messages are visible on the same render where ready or error becomes observable, including aborts that transition back to ready.
Tasks
Acceptance Criteria
- Omitting
throttle caps normal React message publications at approximately 20 updates per second.
throttle: 0 retains the existing per-update behavior.
- Explicit positive values continue to control the publication cadence.
- Stream consumption, callbacks, tool handling, and internal chat state are not delayed.
- Final messages and terminal status remain coherent in the same render.
- The behavior is covered by unit tests and a real browser reproduction.
Tradeoffs
The default protects applications that do not know they need to opt in today and provides a predictable upper bound on normal React rendering work. The cost is up to 50ms of additional visible text latency, fewer intermediate renders, and an explicit opt-out for applications that intentionally require per-chunk rendering.
References
Background
#18525 fixed
useChatthrottling so a configuredthrottlelimits the message snapshots published to React. Before that fix, throttling only delayed the subscription callback; unrelated React renders could still observe the latestchat.messagesarray for every stream chunk and bypass the configured cadence.The fix intentionally preserved the current default: when
throttleis omitted, message snapshots remain unthrottled. Applications therefore need to know that they should opt into throttling to avoid excessive React work during fast, high-frequency streams. This is particularly noticeable on slower devices or when rendering expensive content such as Markdown, tool calls, or context menus, as reported in #6166.Changing the omitted default affects observable rendering behavior and is therefore appropriate for the next major release.
Goal (v8)
Use a 50ms publication cadence for
useChatmessage snapshots whenthrottleis omitted, while preserving an explicit unthrottled opt-out:throttlevalue0Stream processing, tool handling, and callbacks should remain immediate. Only snapshots exposed to React should be paced.
The default cadence must include an immediate leading publication and a terminal flush so the final messages are visible on the same render where
readyorerrorbecomes observable, including aborts that transition back toready.Tasks
useChatthrottle default to 50ms in@ai-sdk/react.throttle: 0as the explicit unthrottled opt-out.useChatAPI documentation and examples to describe the new default and opt-out.@ai-sdk/react.Acceptance Criteria
throttlecaps normal React message publications at approximately 20 updates per second.throttle: 0retains the existing per-update behavior.Tradeoffs
The default protects applications that do not know they need to opt in today and provides a predictable upper bound on normal React rendering work. The cost is up to 50ms of additional visible text latency, fewer intermediate renders, and an explicit opt-out for applications that intentionally require per-chunk rendering.
References