Skip to main content

Function: useEprint()

useEprint(uri, options): UseQueryResult<EprintWithSchemaHints, Error>

Defined in: web/lib/hooks/use-eprint.ts:154

Fetches a single eprint by AT Protocol URI.

Parameters

uri

string

AT Protocol URI of the eprint

options

UseEprintOptions = {}

Query options

Returns

UseQueryResult<EprintWithSchemaHints, Error>

Query result with eprint data, loading state, and error

Remarks

Uses TanStack Query with a 5-minute stale time since eprints rarely change. Returns cached data while revalidating in background.

Example

const { data: eprint, isLoading, error } = useEprint(
'at://did:plc:abc/pub.chive.eprint.submission/123'
);

if (isLoading) return <EprintSkeleton />;
if (error) return <EprintError error={error} />;

return <EprintDetail eprint={eprint} />;

Throws

When the eprint API request fails