Overview
The live, canonical view of a conversation’s messages. Results are stored in Redux and kept in sync byChatProvider socket events, so new messages, edits, reactions and reply-count changes appear in real time, and state is shared with useSendMessage (optimistic inserts), unread tracking and reconnect catch-up. Can be used for the main message stream or for a specific thread (by passing parentMessageId).
Requires
ChatProvider in the component tree.Usage Example
Props
When provided, loads thread replies for this parent message ID instead of the main stream. Replies are sorted ascending (oldest first);
loadMore fetches newer replies.Fields to add to each message, as a single value or an array:
"files"— thefilesfield. Left out by default to keep payloads small."grants"— the reputation-grant summary atmessage.grants:{ total, count, viewerTotal }over positive grants. Populated by thereputationbundle; on a project without it the summary comes back zero-filled rather than missing.
Returns
The loaded messages in ascending order (oldest first). See ChatMessage.
The last load failure, or
null. Cleared when the next load starts; loadMore() retries it. Shared by every mounted hook showing the same conversation (or the same thread). A SublayError.Loads the next page in reading order. For the main stream: messages older than the oldest currently loaded. For threads (
parentMessageId set): the next page of newer replies.
Retries the load that failed instead, when there is one (a failed first page included). Does nothing while a page is loading or when there is nothing more. Never rejects: a failure lands in error.Reloads from the first page. For the main stream: the latest page replaces the loaded messages, keeping optimistic messages and newer live ones; a message on the page keeps the
files / grants another hook on the conversation fetched for it, except what the server hides on a deleted or removed message: its files (its author still sees the files of their own removed message) and a removed message’s grants. For threads: starts over from the thread’s first reply. Never rejects: a failure lands in error.Notes
- New messages that arrive via the socket (
message:created) are added to the store automatically — no manual refetch needed. Thread replies go to their thread, never to the main stream. - After the socket reconnects, a thread loads the replies sent while it was offline. The main stream’s catch-up is done by
ConversationProvider(see Missed Messages After a Reconnect). - For integration guidance, see Chat: Messages.

