: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
import { MakeLogicType, actions, afterMount, kea, path, props, propsChanged } from 'kea'
import { loaders } from 'kea-loaders'
import { performQuery } from '~/queries/query'
import { setLatestVersionsOnQuery } from '~/queries/schema/query-versions'
import {
InsightActorsQuery,
InsightActorsQueryOptions,
InsightActorsQueryOptionsResponse,
NodeKind,
} from '~/queries/schema/schema-general'
import { isInsightActorsQuery } from '~/queries/utils'
// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
export interface insightActorsQueryOptionsLogicValues {
insightActorsQueryOptions: InsightActorsQueryOptionsResponse | null
insightActorsQueryOptionsLoading: boolean
}
// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
export interface insightActorsQueryOptionsLogicActions {
load: () => {
value: true
}
loadFailure: (
error: string,
errorObject?: any
) => {
error: string
errorObject?: any
}
loadSuccess: (
insightActorsQueryOptions: InsightActorsQueryOptionsResponse | null,
payload?: {
value: true
}
) => {
insightActorsQueryOptions: InsightActorsQueryOptionsResponse | null
payload?: {
value: true
}
}
}
// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
export interface insightActorsQueryOptionsLogicProps {
key: string
query: InsightActorsQuery
}
export type insightActorsQueryOptionsLogicType = MakeLogicType<
insightActorsQueryOptionsLogicValues,
insightActorsQueryOptionsLogicActions,
insightActorsQueryOptionsLogicProps
>
export const insightActorsQueryOptionsLogic = kea<insightActorsQueryOptionsLogicType>([
path(['queries', 'nodes', 'DataTable', 'sourceQueryOptionsLogic']),
props({} as { key: string; query: InsightActorsQuery }),
actions({
load: true,
}),
loaders(({ values, props }) => ({
insightActorsQueryOptions: [
null as InsightActorsQueryOptionsResponse | null,
{
load: async () => {
if (!props.query || !isInsightActorsQuery(props.query)) {
return values.insightActorsQueryOptions || null
}
const optionsQuery: InsightActorsQueryOptions = setLatestVersionsOnQuery(
{
kind: NodeKind.InsightActorsQueryOptions,
source: props.query,
},
{ recursion: false }
)
return await performQuery(optionsQuery)
},
},
],
})),
afterMount(({ actions }) => {
actions.load()
}),
propsChanged(({ actions, props }, oldProps) => {
if (JSON.stringify(props.query) !== JSON.stringify(oldProps.query)) {
actions.load()
}
}),
])