Overview
useFetchCommentsByUserIdWrapper is a stateful wrapper around useFetchCommentsByUserId that manages the list, the cursor and the sort for a user’s comment history — for example, the comments tab of a profile page.
The hook doesn’t fetch until userId is set. Changing the sort, or any prop, resets the list and fetches from the start. See Fetch Comments by User for which comments the list contains.
Usage Example
Parameters
Only comments on entities from this source, or
"none" for comments on entities with no source. Left out or null: any source.Server default
"exclude". "include-outbound-blocked" re-includes comments by users the signed-in user blocked, marked isAuthorBlocked: true.Related data to populate:
"user", "entity", "space", "parent", "grants", "files". "files" adds the comment’s images and files (requires the files-images bundle).Initial sort direction for
"createdAt" and "top"; ignored (not sent) for "controversial", which ranks one way only. Default: "desc".spaceReputation object is accepted too; only spaces the viewer can read count — see Who sees space reputation.
Returns
The fetched comments. Each
loadMore appends the next page; a comment already in the list isn’t added twice.true while a page is loading, and before userId is first set. When userId is removed after it was set, the list is cleared and loading is false.The last failure loading the list. Cleared when the next load starts. Call
loadMore() to retry — hasMore stays true after a failure, and the retry asks for the same page again, including a first page that failed. A SublayError.Loads the next page, or retries the page that failed. Does nothing while a page is loading or when
hasMore is false, and never throws — failures land in error.Reloads from the first page with the current filters and sort. The loaded comments stay until the new first page replaces them. Never rejects — failures land in
error.
