: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, kea, path, reducers } from 'kea'
import { actionToUrl, urlToAction } from 'kea-router'
import { urls } from 'scenes/urls'
import { stringifiedExamples } from '~/queries/examples'
const DEFAULT_QUERY: string = stringifiedExamples['HogQLRaw']
// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
export interface debugSceneLogicValues {
query1: string
query2: string
}
// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
export interface debugSceneLogicActions {
setQuery1: (query: string) => {
query: string
}
setQuery2: (query: string) => {
query: string
}
}
export type debugSceneLogicType = MakeLogicType<debugSceneLogicValues, debugSceneLogicActions>
export const debugSceneLogic = kea<debugSceneLogicType>([
path(['scenes', 'query', 'debugSceneLogic']),
actions({
setQuery1: (query: string) => ({ query: query }),
setQuery2: (query: string) => ({ query: query }),
}),
reducers({
query1: [DEFAULT_QUERY, { setQuery1: (_, { query }) => query }],
query2: [DEFAULT_QUERY, { setQuery2: (_, { query }) => query }],
}),
actionToUrl(({ values }) => ({
setQuery1: ({ query }) => {
return [
urls.debugQuery(),
{},
{ q: query, ...(values.query2 ? { q2: values.query2 } : {}) },
{ replace: true },
]
},
setQuery2: () => {
return [urls.debugQuery(), {}, { q: values.query1, q2: values.query2 }, { replace: true }]
},
})),
urlToAction(({ actions, values }) => ({
[urls.debugQuery()]: (_, __, { q, q2 }) => {
if (q && q !== values.query1) {
actions.setQuery1(q)
}
if ((q2 ?? '') !== (values.query2 ?? '')) {
actions.setQuery2(q2 ?? '')
}
},
})),
])