Skip to main content

Overview

useSpaceListActions provides the low-level fetch, create, and delete operations used internally by useSpaceList. In most cases you should use useSpaceList directly, which wraps these actions with Redux state management. Use this hook only when you need direct control over fetching without the Redux list state layer.

Usage Example

Methods

({ listId, ...props }: { listId: string } & FetchParams) => Promise<Space[] | null>
Fetch spaces for the given list. Updates Redux state with the results. params takes page, limit, sortBy ("createdAt", "members" or "alphabetical"), an optional sortDir ("asc" or "desc"; left out, the sort’s natural direction) and the same filters as useSpaceList.
({ listId, ...props }: { listId: string } & CreateSpaceProps) => Promise<SpaceWithPermissions | undefined>
Create a space and insert it into the given list’s state. props takes the same fields as useSpaceList’s createSpace (name required, every other field optional). Resolves with the created space plus memberPermissions; a failed request rejects.
({ listId, spaceId }: { listId: string; spaceId: string }) => Promise<void>
Delete a space and remove it from the given list’s state.
Prefer useSpaceList for most use cases — it handles pagination state, debouncing, and load-more automatically.