MCPcopy
hub / github.com/21st-dev/1code / usePRStatus

Function usePRStatus

src/renderer/hooks/usePRStatus/usePRStatus.ts:22–46  ·  view source on GitHub ↗
({
	worktreePath,
	enabled = true,
	refetchInterval = 10000,
}: UsePRStatusOptions)

Source from the content-addressed store, hash-verified

20 * Returns PR info, loading state, and refetch function.
21 */
22export function usePRStatus({
23 worktreePath,
24 enabled = true,
25 refetchInterval = 10000,
26}: UsePRStatusOptions): UsePRStatusResult {
27 const {
28 data: githubStatus,
29 isLoading,
30 refetch,
31 } = trpc.changes.getGitHubStatus.useQuery(
32 { worktreePath: worktreePath! },
33 {
34 enabled: enabled && !!worktreePath,
35 refetchInterval,
36 },
37 );
38
39 return {
40 pr: githubStatus?.pr ?? null,
41 repoUrl: githubStatus?.repoUrl ?? null,
42 branchExistsOnRemote: githubStatus?.branchExistsOnRemote ?? false,
43 isLoading,
44 refetch,
45 };
46}

Callers 4

ChangesViewFunction · 0.90
ChangesPanelHeaderFunction · 0.90
ChangesHeaderFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected