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.

Usage Example

Parameters

number
Page number to fetch. Defaults to 1.
number
Number of results per page.
string
Sort order: "newest", "oldest", "most_members", or "least_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.
"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.