Overview
useSpaceList provides a stateful, paginated list of public spaces (the space directory) with support for filtering, sorting, search, and creation. For the spaces the current user is a member of, whatever their visibility, use useFetchMySpaces. Each list is identified by a listId and maintains independent Redux state, allowing multiple lists on the same page. Spaces in a list carry no memberPermissions; to show what the current user may do in one, load it with SpaceProvider or useFetchSpace.
For full integration guidance, see Space Lists.
Usage Example
Parameters
Unique identifier for this list’s Redux state slice. Use distinct IDs for independent lists.
Returns
The last load failure, or
null. Cleared when the next load starts; loadMore() retries it. Shared by every mounted hook on the same listId. A SublayError.Trigger a new fetch. Resets to page 1. Takes one object:
filters merge into the list’s current filters, config is the list’s page size, and options control this fetch.Load the next page of spaces and append it, or retry the load that failed (a failed first page is retried as the first page). Does nothing before the first
fetchSpaces, while a load is running on this list, while a debounced filter change is waiting to be fetched, or when there is nothing more. Never rejects: a failure lands in error.Reload page 1 with the list’s stored filters, sort and config; a debounced filter change still waiting runs now instead. The loaded spaces stay until the new first page replaces them. Does nothing before the first
fetchSpaces. Never rejects: a failure lands in error.Create a new space and insert it into the list.
name is required (3–100 characters after trimming); every other field is optional, and null is the same as leaving it out. Resolves with the created space plus memberPermissions (see SpaceMemberPermissions), or undefined if the request failed.Space avatars and banners are uploaded as files, not URLs, so they can’t be
set through this hook. Use useCreateSpace
or useUpdateSpace, which send the image as
multipart/form-data.Current sort setting from Redux state. The list sorts by
"createdAt" (newest first) until you pass another sortBy.Current sort direction.
null means the sort’s natural direction: A–Z for "alphabetical", otherwise newest / most first.The field the current search term is matched against.
null matches the slug, the name or the description.
