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.

1.0 KB
Raw Blame
import { MakeLogicType, actions, kea, path, reducers } from 'kea'

// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
export interface userLogicValues {
    themeMode: string
    user: Record<string, unknown> | null
}

// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
export interface userLogicActions {
    loadUserSuccess: (user: unknown) => {
        user: unknown
    }
    updateUser: (payload: unknown) => {
        payload: unknown
    }
}

export type userLogicType = MakeLogicType<userLogicValues, userLogicActions>

// Toolbar shim — prevents the real userLogic from auto-mounting and making API requests to the wrong host
export const userLogic = kea<userLogicType>([
    path(['toolbar', 'shims', 'userLogic']),
    actions({
        updateUser: (payload: unknown) => ({ payload }),
        loadUserSuccess: (user: unknown) => ({ user }),
    }),
    reducers({
        user: [null as Record<string, unknown> | null, {}],
        themeMode: ['system' as string, {}],
    }),
])