From aa3036670b976caae5d4b8895e5df51e967da771 Mon Sep 17 00:00:00 2001 From: JonathanLab Date: Fri, 8 May 2026 12:52:02 +0200 Subject: [PATCH] feat(inbox): include linear id in data source creation Generated-By: PostHog Code Task-Id: 341ea6f2-0b64-43eb-9761-cca8612c0141 --- .../inbox/components/DataSourceSetup.tsx | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/apps/code/src/renderer/features/inbox/components/DataSourceSetup.tsx b/apps/code/src/renderer/features/inbox/components/DataSourceSetup.tsx index 5d66bf75c..143ef5344 100644 --- a/apps/code/src/renderer/features/inbox/components/DataSourceSetup.tsx +++ b/apps/code/src/renderer/features/inbox/components/DataSourceSetup.tsx @@ -250,6 +250,9 @@ function LinearSetup({ onComplete }: SetupFormProps) { const client = useAuthenticatedClient(); const [loading, setLoading] = useState(false); const [oauthConnected, setOauthConnected] = useState(false); + const [linearIntegrationId, setLinearIntegrationId] = useState< + number | string | null + >(null); const [pollError, setPollError] = useState(null); const pollTimerRef = useRef | null>(null); const pollTimeoutRef = useRef | null>(null); @@ -283,13 +286,14 @@ function LinearSetup({ onComplete }: SetupFormProps) { try { const integrations = await client.getIntegrationsForProject(projectId); - const hasLinear = integrations.some( + const linearIntegration = integrations.find( (i: { kind: string }) => i.kind === "linear", - ); - if (hasLinear) { + ) as { id: number | string } | undefined; + if (linearIntegration) { stopPolling(); setLoading(false); setOauthConnected(true); + setLinearIntegrationId(linearIntegration.id); toast.success("Linear connected"); } } catch { @@ -312,13 +316,16 @@ function LinearSetup({ onComplete }: SetupFormProps) { }, [cloudRegion, projectId, client, stopPolling]); const handleSubmit = useCallback(async () => { - if (!projectId || !client) return; + if (!projectId || !client || !linearIntegrationId) return; setLoading(true); try { await client.createExternalDataSource(projectId, { source_type: "Linear", - payload: { schemas: schemasPayload("linear") }, + payload: { + linear_integration_id: linearIntegrationId, + schemas: schemasPayload("linear"), + }, }); toast.success("Linear data source created"); onComplete(); @@ -329,7 +336,7 @@ function LinearSetup({ onComplete }: SetupFormProps) { } finally { setLoading(false); } - }, [projectId, client, onComplete]); + }, [projectId, client, linearIntegrationId, onComplete]); return (