Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

fix(data-pipelines): hide "Create your first destination" when batch exports exist (#89259)

Rosseedb0bd6374a
diff --git a/frontend/snapshots.yml b/frontend/snapshots.yml
index ff1ea999b7ee..a5ca94ae4f56 100644
--- a/frontend/snapshots.yml
+++ b/frontend/snapshots.yml
@@ -6193,9 +6193,9 @@ snapshots:
scenes-app-data-management-revenue-analytics-event-configuration-modal--default--light:
hash: v1.k794b7964.380602ae2b746844554126dce9f27bca9ec04854e281d8467c8de724f4fd49fc.ySrW_TUWEFnfdhQOLX6USTN5uxF1kODMuE5iXuYWtQU
scenes-app-data-pipelines-destinations-incident-replay-banner--default--dark:
- hash: v1.k794b7964.1fa2847afd2dfb946f145bd4f7a4393dd95c5fccbea361717dafb545b2974238.BS3GjT1_e9vpLhMf5Qr5LkKrpPeP5hgNnmrxX4v_EWQ
+ hash: v1.k794b7964.34c3e603edea48081c522ebbbb268946fdb1333b895d0187e3044f5d25cc9c67.YPyFmrFdGkJ0JY6gYtcZK8_ih879ZKJuG6CxpXGQVfA
scenes-app-data-pipelines-destinations-incident-replay-banner--default--light:
- hash: v1.k794b7964.bc32207650f48ba87bd791f524d84462ecd0cbaa07046e630a1cffde3c68e89e.GHu9dguBRJH_zxhQ8XlozqUsTT3JlpkPVCiFIr26_rk
+ hash: v1.k794b7964.03edf8cad74902dd6afe1b4bcc00171859977e00ca7e415577e4eabeb09e1118.oPgM8rRVPuEyMe_usepFHtxRTIqefhpHQOS3ImXr4_I
scenes-app-data-pipelines-event-filtering--add-condition-and-test-case--dark:
hash: v1.k794b7964.054b485fa44909bda3f635ba9d134cea4dfa7e60bbc65206ba752f23b7729c42._2cxQzZ_XmaTvoI9Z7hIKh5kpuDY5rxQG0-1RNRyDgE
scenes-app-data-pipelines-event-filtering--add-condition-and-test-case--light:
diff --git a/frontend/src/scenes/data-pipelines/DataPipelinesHogFunctions.tsx b/frontend/src/scenes/data-pipelines/DataPipelinesHogFunctions.tsx
index e91c3ddbaac1..4b62f690a067 100644
--- a/frontend/src/scenes/data-pipelines/DataPipelinesHogFunctions.tsx
+++ b/frontend/src/scenes/data-pipelines/DataPipelinesHogFunctions.tsx
@@ -11,7 +11,7 @@ import { SceneContent } from '~/layout/scenes/components/SceneContent'
import { SceneDivider } from '~/layout/scenes/components/SceneDivider'
import { SceneSection } from '~/layout/scenes/components/SceneSection'
import { ProductKey } from '~/queries/schema/schema-general'
-import { HogFunctionTypeType } from '~/types'
+import { HogFunctionType, HogFunctionTypeType } from '~/types'
import { nonHogFunctionsLogic } from './utils/nonHogFunctionsLogic'
import { nonHogFunctionTemplatesLogic } from './utils/nonHogFunctionTemplatesLogic'
@@ -68,6 +68,21 @@ export function DataPipelinesHogFunctions({
const productInfoMapping = MAPPING[kind]
+ // Each source is null until it loads, so keep them unflattened here: the list just needs
+ // everything in one array, but the empty state has to tell "none" apart from "not loaded yet".
+ const manualSources: (HogFunctionType[] | null)[] =
+ kind === 'destination'
+ ? [hogFunctionPluginsDestinations, hogFunctionBatchExports]
+ : kind === 'site_app'
+ ? [hogFunctionPluginsSiteApps]
+ : []
+
+ const manualFunctions = manualSources.length > 0 ? manualSources.flatMap((source) => source ?? []) : undefined
+
+ // A null source has not loaded yet. Counting it as empty flashes the CTA before the data arrives.
+ const isEmpty =
+ !loading && hogFunctions.length === 0 && manualSources.every((source) => source !== null && source.length === 0)
+
return (
<SceneContent>
{productInfoMapping ? (
@@ -78,7 +93,7 @@ export function DataPipelinesHogFunctions({
description={productInfoMapping.description}
docsURL="https://posthog.com/docs/cdp"
actionElementOverride={action}
- isEmpty={hogFunctions.length === 0 && !loading}
+ isEmpty={isEmpty}
/>
) : null}
<SceneSection>
@@ -86,13 +101,7 @@ export function DataPipelinesHogFunctions({
logicKey={logicKey}
type={kind}
additionalTypes={additionalKinds}
- manualFunctions={
- kind === 'destination'
- ? [...(hogFunctionPluginsDestinations ?? []), ...(hogFunctionBatchExports ?? [])]
- : kind === 'site_app'
- ? [...(hogFunctionPluginsSiteApps ?? [])]
- : undefined
- }
+ manualFunctions={manualFunctions}
/>
</SceneSection>
<SceneDivider />