Skip to main content

Overview

useFetchManyReputationGrantsWrapper wraps useFetchManyReputationGrants into a ready-to-render list: it holds the accumulated grants, tracks loading / hasMore, keeps the target summary, and exposes loadMore and refresh. Changing any filter prop (or calling refresh) resets the list to page 1. The server requires exactly one filter shape. With none supplied — or with two — the hook stays idle rather than issuing a request it knows will fail: grants is empty, summary is null, loading is false, and hasMore is false. That makes it safe to mount with a targetId that hasn’t resolved yet. Requires the reputation bundle.

Usage Example

Call refresh after issuing a grant to pull the new row and updated totals.

Parameters

string | null
What this user received.
string | null
What this user sent.
"entity" | "comment" | "chat-message" | null
Who rewarded this item. Supplied together with targetId.
string | null
The rewarded record’s ID. Supplied together with targetType.
number
Page size. Defaults to 10. The server’s maximum is 100; a larger value is rejected with 400 reputation-grant/invalid-query rather than clamped.
string | string[]
Associations to expand. Only "user" is supported — it hydrates both the sender and the recipient.
object
Opt-in per-user space reputation on the hydrated users. { spaceId: "context" } scores each user against that grant’s own space. See Reputation.

Returns

ReputationGrant[]
The accumulated grants, newest first.
GrantSummary | null
{ total, count, viewerTotal } for the target. Populated only on the target filter shape; null otherwise.
boolean
true while fetching.
boolean
Whether more pages remain.
() => void
Advance to the next page and append.
() => void
Re-run the query from page 1.
Chat-message targets are private to their conversation. With targetType: "chat-message", the list is populated only when the logged-in user is a member of that message’s conversation — someone who has left it still counts; for anyone outside it, grants stays empty and summary comes back as { total: 0, count: 0, viewerTotal: 0 } rather than erroring. The recipientId / senderId shapes apply the same test per row, so a user’s own feed keeps the grants made on messages in their own conversations while a caller outside them never sees those rows. Grants on a message moderation has removed are hidden on both shapes, members included. See useFetchManyReputationGrants.
summary is set from the first page and is not re-read by loadMore — it describes the whole target, not the rows loaded so far. Because grant lists are never block-filtered, the rows you render always add up to it.

See Also