Skip to content

v5 mutates message parts which causes problems with the React Compiler #6466

Closed
@zhm

Description

@zhm

Description

When processing the stream inside processUIMessageStream, it mutates the message part, which doesn't update the message object reference itself in the messages array. This ends up causing the messages to never re-render if this is the only change that happens in the stream. Example: a tool call continuation. When I disable the react compiler it re-renders fine. The fix is to copy the messages array in my message list component, but that is obviously a workaround.

part.toolInvocation = invocation;

AI SDK Version

5.0.0-alpha.4

Metadata

Metadata

Labels

ai/uibugSomething isn't workingv5

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions