MCPcopy Create free account
hub / github.com/triggerdotdev/trigger.dev / useOptionalRun

Function useOptionalRun

apps/webapp/app/hooks/useRun.ts:10–22  ·  view source on GitHub ↗
(matches?: UIMatch[])

Source from the content-addressed store, hash-verified

8export type MatchedRun = UseDataFunctionReturn<typeof runLoader>["run"];
9
10export function useOptionalRun(matches?: UIMatch[]) {
11 const project = useOptionalProject(matches);
12 const routeMatch = useTypedMatchesData<typeof runLoader>({
13 id: "routes/_app.orgs.$organizationSlug.projects.$projectParam.jobs.$jobParam.runs.$runParam",
14 matches,
15 });
16
17 if (!project || !routeMatch || !routeMatch.run) {
18 return undefined;
19 }
20
21 return routeMatch.run;
22}
23
24export function useRun(matches?: UIMatch[]) {
25 const run = useOptionalRun(matches);

Callers 2

JobFunction · 0.90
useRunFunction · 0.85

Calls 2

useOptionalProjectFunction · 0.90
useTypedMatchesDataFunction · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…