Skip to main content

Overview

useFetchSpaceBreadcrumb returns a callable function that fetches every space on the path from the top-level space down to and including the given space, root first, as the current user may see it. Useful for breadcrumb navigation in hierarchical space structures. A space the current user can’t see is answered 404 space/not-found, like one that doesn’t exist. Otherwise the whole path comes back, and each entry carries hidden: a space above that the user can’t see (a private space they aren’t an active member of, or a space under one) is exactly { hidden: true }, with no id, name or slug. See Space visibility.

Usage Example

How to render hidden entries is up to you: skip them, show ”…” as above, or start the breadcrumb after the last hidden one.

Parameters

string
required
UUID of the space to fetch the breadcrumb for.

Returns

SpaceBreadcrumbEntry[]
The path from the top-level space down to the given space, root first. A space the user can see has id, shortId, name, slug, avatarFileId, visibility, parentSpaceId, depth and hidden: false; one they can’t see is exactly { hidden: true }. For a top-level space the array holds only that space. See Fetch Space Breadcrumb.
number
Nesting depth of the given space. 0 for a top-level space.
The useSpace hook automatically fetches and exposes the breadcrumb field — you only need this hook when fetching breadcrumbs outside of a SpaceProvider.