Skip to main content

Overview

useFetchEntity returns a function that fetches a single entity by its Sublay entity ID. Use this for on-demand fetches outside of EntityProvider.

Usage Example

Parameters

string
required
The Sublay entity ID to fetch.
string | string[]
Optional. Populate related fields. Accepted values: "user", "space", "topComment", "saved", "files".
string
Optional. Resolves the embedded author’s reputation into a spaceReputation number. Accepts a space <uuid>, "none" (project-general bucket), or "context" (server-derived from the request context). Empty string, "general", and null are rejected. See Reputation.
boolean
Optional. When true, spaceReputation is the subtree sum (the space plus all its descendants). Only honored when spaceReputationId is an explicit <uuid>.

Returns

Entity
The fetched entity. When spaceReputationId is set, the embedded author carries an added spaceReputation number. See Entity data model and Reputation.