: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.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
fix(data-catalog): scope empty state to the metrics tab (#117934)
Marius Andracc769db86c1e
diff --git a/frontend/src/lib/components/NavPanelAdvertisement/MaybeProductPushWelcome.tsx b/frontend/src/lib/components/NavPanelAdvertisement/MaybeProductPushWelcome.tsxindex 95b36bc906d5..62ea4b2f5e0b 100644--- a/frontend/src/lib/components/NavPanelAdvertisement/MaybeProductPushWelcome.tsx+++ b/frontend/src/lib/components/NavPanelAdvertisement/MaybeProductPushWelcome.tsx@@ -58,6 +58,7 @@ function ProductPushWelcome({emptyState: sceneEmptyState,activeSceneId,params: activeSceneComponentParams,+ searchParams,featureFlags,receivedFeatureFlags,forcedMode: forcedModeFromParam(searchParams[EMPTY_STATE_PARAM]),diff --git a/frontend/src/lib/components/ProductEmptyState/ProductEmptyStateGate.test.tsx b/frontend/src/lib/components/ProductEmptyState/ProductEmptyStateGate.test.tsxindex e9c0338fb44f..c9237b8aac2a 100644--- a/frontend/src/lib/components/ProductEmptyState/ProductEmptyStateGate.test.tsx+++ b/frontend/src/lib/components/ProductEmptyState/ProductEmptyStateGate.test.tsx@@ -11,6 +11,7 @@ import { useMocks } from '~/mocks/jest'import { ProductKey } from '~/queries/schema/schema-general'import { initKeaTests } from '~/test/init'+import { productEmptyStateGateActivation } from './gateRender'import { ProductEmptyStateGate } from './ProductEmptyStateGate'import { productSetupStatusLogic } from './productSetupStatusLogic'import type { ProductEmptyStateConfig, ProductSetupStatus, SceneProductEmptyState } from './types'@@ -56,6 +57,27 @@ describe('ProductEmptyStateGate', () => {afterEach(() => cleanup())+ it.each([+ ['metrics', 'on'],+ ['relationships', 'off'],+ ['certifications', 'off'],+ ])('scopes catalog setup to the %s search tab (%s)', (tab, expected) => {+ expect(+ productEmptyStateGateActivation({+ emptyState: {+ ...emptyState,+ scenes: [{ scene: 'DataCatalog', tabs: [undefined, 'metrics'], tabSource: 'search' }],+ },+ activeSceneId: 'DataCatalog',+ params: {},+ searchParams: { tab },+ featureFlags: {},+ receivedFeatureFlags: true,+ forcedMode: null,+ })+ ).toBe(expected)+ })+it.each<ProductSetupStatus>(['loading', 'needs-setup', 'waiting-for-data'])('bypasses %s only while the configured flag is enabled',(status) => {diff --git a/frontend/src/lib/components/ProductEmptyState/ProductEmptyStateGate.tsx b/frontend/src/lib/components/ProductEmptyState/ProductEmptyStateGate.tsxindex 6311e9b1abbb..eff57672d8ce 100644--- a/frontend/src/lib/components/ProductEmptyState/ProductEmptyStateGate.tsx+++ b/frontend/src/lib/components/ProductEmptyState/ProductEmptyStateGate.tsx@@ -54,6 +54,7 @@ export function ProductEmptyStateGate({ emptyState, params, children }: ProductEemptyState,activeSceneId,params: params ?? {},+ searchParams,featureFlags,receivedFeatureFlags,forcedMode,diff --git a/frontend/src/lib/components/ProductEmptyState/gateRender.ts b/frontend/src/lib/components/ProductEmptyState/gateRender.tsindex 5d97463d6642..85cd521a070a 100644--- a/frontend/src/lib/components/ProductEmptyState/gateRender.ts+++ b/frontend/src/lib/components/ProductEmptyState/gateRender.ts@@ -37,12 +37,16 @@ export function forcedModeFromParam(value: unknown): ProductEmptyStateMode | nulfunction coversCurrentSurface(gated: GatedScene,activeSceneId: string | null,- params: Record<string, string | undefined>+ params: Record<string, string | undefined>,+ searchParams: Record<string, string | undefined>): boolean {if (typeof gated === 'string') {return gated === activeSceneId}- return gated.scene === activeSceneId && gated.tabs.includes(params.tab)+ return (+ gated.scene === activeSceneId &&+ gated.tabs.includes(gated.tabSource === 'search' ? searchParams.tab : params.tab)+ )}export type ProductEmptyStateGateActivation = 'off' | 'awaiting-flags' | 'on'@@ -54,6 +58,7 @@ export interface ProductEmptyStateGateSurface {emptyState: SceneProductEmptyStateactiveSceneId: string | nullparams: Record<string, string | undefined>+ searchParams?: Record<string, string | undefined>featureFlags: FeatureFlagsSetreceivedFeatureFlags: booleanforcedMode: ProductEmptyStateMode | null@@ -70,6 +75,7 @@ export function productEmptyStateGateActivation({emptyState,activeSceneId,params,+ searchParams = {},featureFlags,receivedFeatureFlags,forcedMode,@@ -84,7 +90,10 @@ export function productEmptyStateGateActivation({return 'off'}}- if (emptyState.scenes && !emptyState.scenes.some((gated) => coversCurrentSurface(gated, activeSceneId, params))) {+ if (+ emptyState.scenes &&+ !emptyState.scenes.some((gated) => coversCurrentSurface(gated, activeSceneId, params, searchParams))+ ) {return 'off'}if (emptyState.bypassFeatureFlag && !forcedMode) {diff --git a/frontend/src/lib/components/ProductEmptyState/types.ts b/frontend/src/lib/components/ProductEmptyState/types.tsindex 554c939232d8..5d2cfbbe9c17 100644--- a/frontend/src/lib/components/ProductEmptyState/types.ts+++ b/frontend/src/lib/components/ProductEmptyState/types.ts@@ -222,4 +222,4 @@ export interface SceneProductEmptyState {* `tab` route param the gate covers, including `undefined` for the URL that carries no tab* segment - `/workflows` and `/workflows/workflows` are the same tab.*/-export type GatedScene = string | { scene: string; tabs: (string | undefined)[] }+export type GatedScene = string | { scene: string; tabs: (string | undefined)[]; tabSource?: 'path' | 'search' }diff --git a/products/data_catalog/frontend/emptyState/dataCatalogEmptyState.tsx b/products/data_catalog/frontend/emptyState/dataCatalogEmptyState.tsxindex cf2eac8a4286..a66ed64c9b00 100644--- a/products/data_catalog/frontend/emptyState/dataCatalogEmptyState.tsx+++ b/products/data_catalog/frontend/emptyState/dataCatalogEmptyState.tsx@@ -14,6 +14,7 @@ const HedgehogStampApproved = pngHoggie(stampApprovedPng)export const dataCatalogEmptyState: SceneProductEmptyState = {statusLogic: dataCatalogSetupLogic,+ scenes: [{ scene: 'DataCatalog', tabs: [undefined, 'metrics'], tabSource: 'search' }],config: {productKey: ProductKey.DATA_CATALOG,productName: 'Data catalog',