Skip to main content
Requires the entities bundle. A project without the entities bundle returns 403 database/tables-not-available. See Bundles.

Overview

useFetchManyEntities returns a function that fetches a paginated list of entities with full filtering and sorting support. It keeps no state of its own. For continuous-scroll or load-more list UIs, use useEntityList, which keeps the list and its pagination state, or useFetchManyEntitiesWrapper, which wraps this hook with pagination and sort state.

Usage Example

Parameters

number
Page number (1-indexed). Defaults to 1.
number
Results per page: a whole number from 1 to 100. Defaults to 10. A larger value is rejected with 400 entity/invalid-query, never lowered to 100.
string
Field to sort by. Options: "createdAt", "top", "hot", "controversial", or "metadata.<property>" to sort by a metadata field.
string
Which reaction top ranks by. Only sent when sortBy is "top"; ignored for every other sort.
string
Sort direction: "asc" or "desc". Not accepted with "hot" or "controversial", which rank one way only.
string
Sort algorithm type. Options: "auto", "numeric", "text", "boolean", "timestamp". Used when sorting by a metadata field.
string
Filter entities to a time window. Options: "day", "week", "month", "year".
string | "none"
Only entities from this source, or "none" for entities with no source. Left out: any source.
string | "none"
Only entities in this space, or "none" for entities in no space. Left out: any space, or none.
string
Filter to entities created by a specific user.
boolean
If true, return only entities from users the authenticated user follows.
object
Filter by keywords. See Entity List Filters for the full filter schema.
object
Filter by title content. See Entity List Filters.
object
Filter by body content. See Entity List Filters.
object
Filter by attachments data. See Entity List Filters.
object
Filter by geographic proximity. See Entity List Filters.
object
Filter by metadata fields. See Entity List Filters.
"include-all" | "exclude" | "only"
Filter by effective NSFW status (entity.nsfw OR its space's nsfwEffective). "include-all" (default) adds no predicate; "exclude" drops effective-NSFW entities; "only" returns only effective-NSFW entities. On projects without the spaces bundle it applies against the entity’s own nsfw flag alone. See Entity NSFW flagging.
EntityIncludeParam
Populate related fields, as a single value or an array. Accepted values: "user", "space", "topComments", "saved", "files", "grants".
number
With "topComments" included: how many top comments per entity. Server default 1, maximum 5. Not sent when include doesn’t contain "topComments".
ReactionType
With "topComments" included: the reaction whose raw count ranks the top comments. Server default "upvote". Not sent when include doesn’t contain "topComments".

Returns

Entity[]
Array of entities for the current page. When spaceReputation is requested, each embedded author carries an added spaceReputation number. See Reputation.
number
Current page number.
number
Number of results per page.
number
Total number of pages matching the filters.
number
Total count of entities matching the filters (across all pages).
boolean
true if there are additional pages available.