diff --git a/apps/code/src/renderer/api/posthogClient.ts b/apps/code/src/renderer/api/posthogClient.ts index f660aea4b..b800ae5a3 100644 --- a/apps/code/src/renderer/api/posthogClient.ts +++ b/apps/code/src/renderer/api/posthogClient.ts @@ -1341,15 +1341,18 @@ export class PostHogAPIClient { } } - async getIntegrations() { + async getIntegrations(kind?: string) { const teamId = await this.getTeamId(); - return this.getIntegrationsForProject(teamId); + return this.getIntegrationsForProject(teamId, kind); } - async getIntegrationsForProject(projectId: number) { + async getIntegrationsForProject(projectId: number, kind?: string) { const url = new URL( `${this.api.baseUrl}/api/environments/${projectId}/integrations/`, ); + if (kind) { + url.searchParams.set("kind", kind); + } const response = await this.api.fetcher.fetch({ method: "get", url, diff --git a/apps/code/src/renderer/features/inbox/components/DataSourceSetup.tsx b/apps/code/src/renderer/features/inbox/components/DataSourceSetup.tsx index ae0d944cb..75f54e870 100644 --- a/apps/code/src/renderer/features/inbox/components/DataSourceSetup.tsx +++ b/apps/code/src/renderer/features/inbox/components/DataSourceSetup.tsx @@ -136,8 +136,10 @@ function GitHubSetup({ onComplete, onCancel }: SetupFormProps) { try { if (!client) return; // Trigger a refetch of integrations - const integrations = - await client.getIntegrationsForProject(projectId); + const integrations = await client.getIntegrationsForProject( + projectId, + "github", + ); const hasGithub = integrations.some( (i: { kind: string }) => i.kind === "github", ); diff --git a/apps/code/src/renderer/features/onboarding/hooks/usePrefetchSignalData.ts b/apps/code/src/renderer/features/onboarding/hooks/usePrefetchSignalData.ts index 5f65d593a..84c7f11ab 100644 --- a/apps/code/src/renderer/features/onboarding/hooks/usePrefetchSignalData.ts +++ b/apps/code/src/renderer/features/onboarding/hooks/usePrefetchSignalData.ts @@ -36,7 +36,7 @@ export function usePrefetchSignalData(): void { queryClient.prefetchQuery({ queryKey: ["integrations", "list"], queryFn: async () => { - const integrations = await client.getIntegrations(); + const integrations = await client.getIntegrations("github"); const ghIntegration = ( integrations as { id: number; kind: string }[] ).find((i) => i.kind === "github"); diff --git a/apps/code/src/renderer/hooks/useIntegrations.ts b/apps/code/src/renderer/hooks/useIntegrations.ts index 9bf21542f..53c0c04ab 100644 --- a/apps/code/src/renderer/hooks/useIntegrations.ts +++ b/apps/code/src/renderer/hooks/useIntegrations.ts @@ -38,7 +38,7 @@ export function useIntegrations() { const query = useAuthenticatedQuery( integrationKeys.list(), - (client) => client.getIntegrations() as Promise, + (client) => client.getIntegrations("github") as Promise, ); useEffect(() => {