Overview
useUpdateSpace returns a callable function for updating a space. Only space admins can update a space. Supports replacing the avatar and banner images (avatarFile, bannerFile) and removing them (removeFileIds).
When using
SpaceProvider, prefer calling updateSpace from useSpace — it handles state updates automatically.Usage Example
Parameters
The changes go next tospaceId, all optional, not inside an update object (an update key throws a SublayError before anything is sent).
New display name (3–100 characters after trimming). Leave it out to keep the current name; a name can’t be removed.
Updated posting permission:
"anyone", "members" (active members), or "team" (the space’s active admins and moderators).Updated visibility: who can find and see the space (and the spaces under it). Independent of
readingPermission. See Space visibility.Updated NSFW own-flag. Toggling it recomputes this space’s effective NSFW and cascades it top-down to every descendant space (and, live, to their entities) in the same transaction. See Space NSFW flagging.
New avatar image, replacing the current one.
file is a File or Blob, or a React Native file { uri, name, type? }; options must include mode (see Upload Image). With an image, the request is sent as multipart/form-data.New banner image, replacing the current one; same shape as
avatarFile.Files to remove: the space’s
avatarFileId and/or bannerFileId. Removing one clears that image. Any other id refuses the whole update (400 space/invalid-remove-file-ids).Returns
Returns the updated Space object plusmemberPermissions: what the user may do in the space after the update (see SpaceMemberPermissions). It carries no parentSpace or childSpaces. Inside a SpaceProvider for the same space, the provider’s space takes the update and the new memberPermissions, keeping its hierarchy.
