MCPcopy
hub / github.com/triggerdotdev/trigger.dev / useEventDetails

Function useEventDetails

packages/react/src/events.ts:13–42  ·  view source on GitHub ↗
(eventId: string | undefined)

Source from the content-addressed store, hash-verified

11export type UseEventDetailsResult = UseQueryResult<GetEvent>;
12
13export function useEventDetails(eventId: string | undefined): UseEventDetailsResult {
14 const { apiUrl, publicApiKey, queryClient } = useTriggerProvider();
15
16 return useQuery(
17 {
18 queryKey: [`triggerdotdev-event-${eventId}`],
19 queryFn: async () => {
20 return await zodfetch(GetEventSchema, `${apiUrl}/api/v2/events/${eventId}`, {
21 method: "GET",
22 headers: {
23 Authorization: `Bearer ${publicApiKey}`,
24 },
25 });
26 },
27 refetchInterval: (data) => {
28 if (
29 data &&
30 data.runs.length > 0 &&
31 data.runs.every((r) => runResolvedStatuses.includes(r.status))
32 ) {
33 return false;
34 }
35
36 return defaultRefreshInterval;
37 },
38 enabled: !!eventId,
39 },
40 queryClient
41 );
42}
43
44export function useEventRunDetails(
45 eventId: string | undefined,

Callers 3

useEventRunStatusesFunction · 0.90
ReactHooksFunction · 0.90
useEventRunDetailsFunction · 0.85

Calls 2

useTriggerProviderFunction · 0.90
zodfetchFunction · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…