Overview
useEntityComments is a lower-level hook that fetches and manages a paginated comment tree for a given entity ID. It is used internally by CommentSectionProvider. Use it directly when you need comment tree management without the full provider.
For most use cases, use
CommentSectionProvider + useCommentSection instead. See Comment Section.Usage Example
Props
The entity ID to fetch comments for.
Comments per page. Default:
10.Initial sort:
"top", "new", or "controversial". Default: "new".Populate related data. Accepted values:
"user", "entity", "space", "parent".Return Values
Flat map of all comments and their replies, keyed by comment ID.
Paginated root-level comments (not newly added ones).
Newly added root comments from this session, sorted newest-first.
true during fetches.true when more pages are available.Current sort order.
Changes sort order and resets to page 1.
Loads the next page.
Inserts comments into the tree. Pass
newlyAdded: true for freshly submitted comments.Removes a comment from the tree.
Marks a comment as deleted (Reddit-style placeholder) without removing it from the tree.

