Overview
useFetchMySpaces returns a callable function that fetches the spaces where the authenticated user has a membership (active by default). The response includes membership metadata alongside each space. Every space the user is an active member of is listed, whatever its visibility, so this is the hook for a “my spaces” screen (a pending, banned or rejected membership of a space the user can’t see is left out); useFetchManySpaces lists public spaces only. It can search within the user’s spaces and sort them.
Usage Example
Parameters
Membership status to list:
"active" (default), "pending", or "banned". Use "pending" to show join requests still awaiting approval.Only memberships with this role:
"admin", "moderator" or "member", or an array of them.true returns every matching membership without pagination; the response then has no pagination.Free-text search term, matched as a case-insensitive substring. A blank value is left out of the request, and
searchFields with it.The one field
query is matched against. Leave it out to match the slug, the name or the description.Sort order:
"joinedAt" (when the user joined), "createdAt" (when the space was created), "alphabetical" (by name) or "members" (by active member count). Defaults to "joinedAt".Direction,
"asc" or "desc", for any sortBy. Left out: A–Z for "alphabetical", otherwise newest / most first.Narrows the list by where each space sits in the tree.
"none": the user’s memberships in top-level spaces only. A space id: their memberships in that space’s direct sub-spaces. "any", left out or null: memberships at every level (the default). null is left out of the request, never sent as "none".A membership in a sub-space whose parent the user isn’t a member of is not top-level, so "none" leaves it out.Optional. A single value or an array; the only value is
"files". Pass it to populate avatar and banner file objects on each space.Returns
Each item contains a
space (Space) and a membership object with membershipId, role, status, and joinedAt.
