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(workflows): guard conditional branch render against missing config array (#73531)

Sean Mallia957fcacf89d7
diff --git a/frontend/snapshots.yml b/frontend/snapshots.yml
index 9764eb66a90c..83491ecd3f80 100644
--- a/frontend/snapshots.yml
+++ b/frontend/snapshots.yml
@@ -5053,7 +5053,7 @@ snapshots:
replay-scenes-group--group-events-tab-with-modal-not-found--dark:
hash: v1.k794b7964.1326c64c54c2a719ef5e25d56ccd0a81aae74fdaaafb2aabe6994e9d34160406.MiSJPVzJoZFlKF5pViwuZUD-BTkuqq_m83d96uJy7bY
replay-scenes-group--group-events-tab-with-modal-not-found--light:
- hash: v1.k794b7964.1f70b90562d7d6f31e687dd47360c5c9e3ec9111b39443da3b56fa2532f534d5.IXrpXBGBprUBLitWrw_qN9Ee7JLn76tyJ-QeOniJKtY
+ hash: v1.k794b7964.a6ae7283986232e26123783358c3991b853b37e393bc0f846a648364249cdf6c.tzQYw0ED7oQFd1x7CLAuYcFrQoOirZMRh3X_5E5a5b4
replay-scenes-group--group-recording-tab-empty--dark:
hash: v1.k794b7964.0660887202ba71055373168f4b9df5cdc8251c89f0f96b77c4b3196845362f70.VFxGeaTyLzGuovqDxnkS9wWUmq2J0edku92QEPb1mJI
replay-scenes-group--group-recording-tab-empty--light:
@@ -5587,7 +5587,7 @@ snapshots:
scenes-app-dashboards--show-without-post-hog-ai-button-label--wide--light:
hash: v1.k794b7964.bdf731e7da5ee6a208a690c18c0d5e38bd06011b383c57f526196da0f91f829c.1hMJmP7uN1mi3H6iqZFeDmGORCs42h4JJm5-VWxN9Rs
scenes-app-dashboards--view-only-dashboard--dark:
- hash: v1.k794b7964.a65acee97de57aeef30368365580e0e2c962193d6215acf55dac639823cb0ca8.zkO7nnEw6JoWOSq1KJ1DQrXzCI1FSmD0yzRsrMwcfA0
+ hash: v1.k794b7964.e15bc2243afd7e6692e7a30f3b077d727ba9ffa64c3c978c2dfe119564bf06da.M0ASGjGeENcp9BtMk92sx0r3HSFt4NsPJkjSzJCfd4k
scenes-app-dashboards--view-only-dashboard--light:
hash: v1.k794b7964.7ebc4aa50c00cbfa580fd96d32ef6565a6bd399e1ae6289278d36309c89e87f1.9xwqldb2HI9IewJABGeU3kmuyGXS-hwbloJgjznVypQ
scenes-app-dashboards-add-insight-to-dashboard-modal--default--dark:
diff --git a/products/workflows/frontend/Workflows/hogflows/steps/StepConditionalBranch.tsx b/products/workflows/frontend/Workflows/hogflows/steps/StepConditionalBranch.tsx
index 8a96bbe143a7..c56164d576a2 100644
--- a/products/workflows/frontend/Workflows/hogflows/steps/StepConditionalBranch.tsx
+++ b/products/workflows/frontend/Workflows/hogflows/steps/StepConditionalBranch.tsx
@@ -21,7 +21,7 @@ export function StepConditionalBranchConfiguration({
node: Node<Extract<HogFlowAction, { type: 'conditional_branch' }>>
}): JSX.Element {
const action = node.data
- const { conditions } = action.config
+ const conditions = action.config.conditions ?? []
const { edgesByActionId } = useValues(hogFlowEditorLogic)
const { setWorkflowAction, setWorkflowActionEdges } = useActions(hogFlowEditorLogic)
diff --git a/products/workflows/frontend/Workflows/hogflows/steps/StepRandomCohortBranch.tsx b/products/workflows/frontend/Workflows/hogflows/steps/StepRandomCohortBranch.tsx
index 2f5fe97550fd..3e99bb1ab880 100644
--- a/products/workflows/frontend/Workflows/hogflows/steps/StepRandomCohortBranch.tsx
+++ b/products/workflows/frontend/Workflows/hogflows/steps/StepRandomCohortBranch.tsx
@@ -19,7 +19,7 @@ export function StepRandomCohortBranchConfiguration({
node: Node<Extract<HogFlowAction, { type: 'random_cohort_branch' }>>
}): JSX.Element {
const action = node.data
- const { cohorts } = action.config
+ const cohorts = action.config.cohorts ?? []
const { edgesByActionId } = useValues(hogFlowEditorLogic)
const { setWorkflowAction, setWorkflowActionEdges } = useActions(hogFlowEditorLogic)
diff --git a/products/workflows/frontend/Workflows/hogflows/steps/utils.ts b/products/workflows/frontend/Workflows/hogflows/steps/utils.ts
index 6a8ed161be47..3a1efb1ea7d9 100644
--- a/products/workflows/frontend/Workflows/hogflows/steps/utils.ts
+++ b/products/workflows/frontend/Workflows/hogflows/steps/utils.ts
@@ -61,12 +61,12 @@ export function useDebouncedNameInputs<T extends { name?: string }>(
localNames: (string | undefined)[]
handleNameChange: (index: number, value: string | undefined) => void
} {
- const [localNames, setLocalNames] = useState<(string | undefined)[]>(items.map((item) => item.name))
+ const [localNames, setLocalNames] = useState<(string | undefined)[]>((items ?? []).map((item) => item.name))
// Update local state when items change from external sources
useEffect(() => {
- setLocalNames(items.map((item) => item.name))
- }, [items.length, items]) // Only update when number of items changes
+ setLocalNames((items ?? []).map((item) => item.name))
+ }, [items?.length, items]) // Only update when number of items changes
// Debounced function to update items
const debouncedUpdate = useDebouncedCallback((index: number, value: string | undefined) => {