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(autoresearch): keep the model list an array when its load fails (#115273)

posthog[bot]519973241bef
diff --git a/products/autoresearch/frontend/autoresearchLogic.test.ts b/products/autoresearch/frontend/autoresearchLogic.test.ts
index b96e0bec4d25..f28dc063cfaa 100644
--- a/products/autoresearch/frontend/autoresearchLogic.test.ts
+++ b/products/autoresearch/frontend/autoresearchLogic.test.ts
@@ -61,6 +61,7 @@ describe('autoresearchLogic', () => {
await expectLogic(logic).toFinishAllListeners()
expect(statusLogicValues()).toBe('unknown')
expect(logic.values.pipelinesLoadFailed).toBe(true)
+ expect(logic.values.pipelines).toEqual([])
mockList.mockReturnValue(new Promise(() => {}))
logic.actions.loadPipelines()
diff --git a/products/autoresearch/frontend/autoresearchLogic.ts b/products/autoresearch/frontend/autoresearchLogic.ts
index eafeca34bda0..5e13cfb81905 100644
--- a/products/autoresearch/frontend/autoresearchLogic.ts
+++ b/products/autoresearch/frontend/autoresearchLogic.ts
@@ -136,10 +136,14 @@ export const autoresearchLogic = kea<autoresearchLogicType>([
}),
reducers({
// Apply a successful row action at once, so the row cannot offer a stale action while the list reloads.
- pipelines: {
- pipelineUpdated: (state, { pipeline }) => state.map((row) => (row.id === pipeline.id ? pipeline : row)),
- pipelineRemoved: (state, { id }) => state.filter((row) => row.id !== id),
- },
+ // Give the default here too: this reducer registers before the loader, so without it the list starts as null.
+ pipelines: [
+ [] as AutoresearchPipelineApi[],
+ {
+ pipelineUpdated: (state, { pipeline }) => state.map((row) => (row.id === pipeline.id ? pipeline : row)),
+ pipelineRemoved: (state, { id }) => state.filter((row) => row.id !== id),
+ },
+ ],
mutatingPipelineIds: [
{} as Record<string, boolean>,
{