Overview
useFetchManyChatMessagesWrapper is a stateful wrapper around useFetchManyChatMessages that manages the message list and cursor pagination for you. It keeps results in local component state — not Redux — and never receives socket updates.
Use it for a read-only or filtered list of messages that should not be touched by live traffic — for example, a “messages with replies” panel, an admin/moderation view, or any custom message list outside the live conversation stream. For the live canonical conversation view, use useLiveChatMessages instead.
This is a point-in-time query: it does not auto-update from socket events. Call
refetch (e.g. on a refresh button, or on a socket signal of your choosing) to pick up new matches. It does not require ChatProvider.Usage Example
Props
Sort by creation time. Defaults to
"desc" (newest first), where loadMore fetches older messages. With "asc", loadMore fetches newer messages.Fields to add to each message, as a single value or an array:
"files"— thefilesfield."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.
Optional filters.
filters.hasReplies (boolean): when true, returns only messages that have thread replies (threadReplyCount > 0); when false, only messages with none. Filters by thread replies, not quotings.Threads are one level deep, so
hasReplies: true together with parentMessageId always yields an empty list. This wrapper exposes only messages; use the lower-level useFetchManyChatMessages if you want the notice explaining why.Returns
The loaded messages. See ChatMessage.
The last load failure, or
null. Cleared when the next load starts; loadMore() retries it. A SublayError.Loads the next page in the direction of
sortDir and appends it: older messages with "desc" (the default), newer ones with "asc". Retries the load that failed instead, when there is one. Does nothing while loading or when there is nothing more. Never rejects: a failure lands in error.
