Overview
useFetchManyComments returns a function that fetches one level of a comment thread (GET /comments): an entity’s top-level comments (entityId) or a comment’s direct replies (parentCommentId). It’s the fetch function behind useEntityComments and useReplies. Use it directly when you need full control over a thread request.
For a user’s comments across entities, use useFetchCommentsByUserId.
Usage Example
Parameters
Pass exactly one ofentityId or parentCommentId; the props type refuses neither and both. A replies fetch takes parentCommentId alone, since the parent decides the entity.
pagination.nextCursor from the previous response. Omit for the first page. Send the same sort as the request that returned it."createdAt", "top" (raw count of sortByReaction) or "controversial". Server default "createdAt".Applies to
"createdAt" and "top"; not accepted with "controversial", which ranks one way only. Server default "desc".Sort for the nested levels:
"createdAt", "top" or "controversial". Defaults to sortBy.Sort direction for the nested levels. Defaults to
sortDir. Not sent when the nested sort is "controversial".Related data to populate, at every level.
"files" adds the comment’s images and files (requires the files-images bundle).Returns
APromise<CursorPaginatedResponse<Comment>>:
The comments at the requested level. With
replyDepth above 0, each carries nested replies ({ data, pagination }). When spaceReputation is requested, each embedded author carries an added spaceReputation number. See Reputation.
