Skip to main content

Overview

useFetchManySpaces returns a callable function for fetching multiple spaces. It supports searching by name, slug, description, or a combined query; filtering by membership or parent space; and sorting. For paginated, stateful lists with load-more support, use useSpaceList instead.
This is a discovery surface: only public spaces are listed. unlisted and private spaces are excluded for non-members (they stay reachable by direct link/slug). The memberOf=true filter is the exception — it returns the caller’s own spaces regardless of visibility. See Space visibility.

Usage Example

Parameters

number
Page number to fetch. Defaults to 1.
number
Number of results per page.
string
Sort order: "newest", "members" (most members first), or "alphabetical". Defaults to "members".
string | null
Filter spaces whose slug contains this value.
string | null
Filter spaces whose name contains this value.
string | null
Filter spaces whose description contains this value.
string | null
Search across name, slug, and description simultaneously.
boolean
When true, returns only spaces where the current user is an active member.
string | null
Filter to child spaces of a specific parent. Pass null for root-level spaces only.
"include-all" | "exclude" | "only"
Filter by each space’s nsfwEffective (own flag OR any ancestor). "include-all" (default) adds no predicate; "exclude" drops effective-NSFW spaces; "only" returns only them. Because the filter keys off effective status, "only" may return an NSFW child whose safe parent is omitted — results are not guaranteed to form a contiguous tree. See Space NSFW flagging.
"files" | string[]
Optional. Pass "files" to include avatar file objects in each result.

Returns

Space[]
Array of Space objects.
object
Pagination metadata including page, limit, total, and hasMore.