Skip to main content

Function: useLogActivity()

useLogActivity(): UseMutationResult<{ activityId: string; }, Error, LogActivityInput>

Defined in: web/lib/hooks/use-activity.ts:180

Hook for logging a new activity.

Returns

UseMutationResult<{ activityId: string; }, Error, LogActivityInput>

Mutation for logging activities

Remarks

Call this before performing a PDS write operation. The activity will be correlated with the firehose event when the record appears.

Example

const logActivityMutation = useLogActivity();
const rkey = generateRkey();

// Log activity before PDS write
await logActivityMutation.mutateAsync({
collection: 'pub.chive.preprint.submission',
rkey,
action: 'create',
category: 'preprint_submit',
});

// Perform PDS write with the same rkey
await agent.com.atproto.repo.createRecord({
repo: did,
collection: 'pub.chive.preprint.submission',
rkey, // Use generated rkey for correlation
record,
});