Skip to content

useUIMessages / streaming freezes when message count approaches initialNumItems limit #193

@christiannwamba

Description

@christiannwamba

When using useUIMessages (or useThreadMessages) with an initialNumItems limit, streaming consistently freezes once the thread's message count approaches that limit. The stream completes successfully on the backend, but the frontend remains stuck in a streaming state.

Reproduction Steps

  1. Set initialNumItems: 20 in the messages hook (or any value)
  2. Have a conversation that accumulates messages approaching that limit
  3. Send a new message when message count is near/at the limit
  4. Result: Frontend freezes in streaming state indefinitely

Expected Behavior

Streaming should complete normally regardless of how many messages exist in the thread relative to initialNumItems.

Actual Behavior

  • Backend: Stream completes successfully (onFinish, consumeStream all fire correctly)
  • Frontend: UI remains stuck in streaming state

Environment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions