Overview
useFetchManyCommentsWrapper is a stateful wrapper around useFetchManyComments that manages pagination, sort state, and the comment list for you. Use it when you need a custom paginated comment list outside of CommentSectionProvider — for example, a user profile page showing all comments a user has made, or a custom thread viewer.
Changing sortBy resets the list and re-fetches from page 1. At least one of entityId, userId, or parentId must be provided — the hook will not fetch otherwise.
Usage Example
Parameters
string | null
Filter to comments on a specific entity.
string | null
Filter to comments by a specific user.
string | null
Filter to replies of a specific parent comment.
string | null
Filter to comments within a specific source.
number
Number of comments per page. Default:
10."createdAt" | "top" | "controversial"
Initial sort order. Default:
"createdAt". "new"/"old" are deprecated aliases for "createdAt" (removed in v8)."asc" | "desc"
Initial sort direction for
sortBy: "createdAt". Default: "desc" (newest first).CommentIncludeParam
Populate related data. Accepted values:
"user", "entity", "space", "parent".Returns
Comment[]
The current list of fetched comments. Appended to on each
loadMore call.boolean
true while fetching the initial page or loading more.boolean
true if additional pages are available.CommentsSortByOptions | null
Current sort order.
(sortBy: CommentsSortByOptions) => void
Change the sort order. Resets the comment list and re-fetches from page 1.
"asc" | "desc"
Current sort direction for
sortBy: "createdAt".(sortDir: "asc" | "desc") => void
Change the sort direction. Resets the comment list and re-fetches from page 1.
() => void
Load the next page of comments. Appends to the existing list.

