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(funnels): keep layout switcher visible (#83627)

Xander74610fac96ed
diff --git a/frontend/src/scenes/funnels/funnelDataLogic.test.ts b/frontend/src/scenes/funnels/funnelDataLogic.test.ts
index 3aac8d443264..e1112203a8bc 100644
--- a/frontend/src/scenes/funnels/funnelDataLogic.test.ts
+++ b/frontend/src/scenes/funnels/funnelDataLogic.test.ts
@@ -2,6 +2,7 @@ import { router } from 'kea-router'
import { expectLogic } from 'kea-test-utils'
import timekeeper from 'timekeeper'
+import { FunnelLayout } from 'lib/constants'
import { AGGREGATION_LABEL_FOR_CUSTOM_DATA_WAREHOUSE } from 'scenes/insights/filters/aggregationTargetUtils'
import { teamLogic } from 'scenes/teamLogic'
@@ -78,6 +79,25 @@ describe('funnelDataLogic', () => {
})
})
+ it('with layout but missing funnel viz type', async () => {
+ const query: FunnelsQuery = {
+ kind: NodeKind.FunnelsQuery,
+ series: [],
+ funnelsFilter: {
+ layout: FunnelLayout.horizontal,
+ },
+ }
+
+ await expectLogic(logic, () => {
+ logic.actions.updateQuerySource(query)
+ }).toMatchValues({
+ querySource: expect.objectContaining({ kind: NodeKind.FunnelsQuery }),
+ isStepsFunnel: true,
+ isTimeToConvertFunnel: false,
+ isTrendsFunnel: false,
+ })
+ })
+
it('for steps viz', async () => {
const query: FunnelsQuery = {
kind: NodeKind.FunnelsQuery,
diff --git a/frontend/src/scenes/funnels/funnelDataLogic.ts b/frontend/src/scenes/funnels/funnelDataLogic.ts
index 0acfada1cbd6..4052f3bb4b3d 100644
--- a/frontend/src/scenes/funnels/funnelDataLogic.ts
+++ b/frontend/src/scenes/funnels/funnelDataLogic.ts
@@ -639,9 +639,7 @@ export const funnelDataLogic = kea<funnelDataLogicType>([
(funnelsFilter: FunnelsFilter | null | undefined): boolean | null => {
return funnelsFilter === null
? null
- : funnelsFilter === undefined
- ? true
- : funnelsFilter.funnelVizType === FunnelVizType.Steps
+ : (funnelsFilter?.funnelVizType ?? FunnelVizType.Steps) === FunnelVizType.Steps
},
],
isTimeToConvertFunnel: [