: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 { useEffect, useState } from 'react'
import { CommandKSearchPalette } from './CommandKSearchPalette'
/** Command K search with smart filters. The UX contract lives in COMMAND_K_SEARCH_UX.md next to this file. */
export function CommandKSearch(): JSX.Element | null {
// kea mounts a logic during render, and React can restart the render that loads this chunk without an unmount,
// which leaks the logic and its query. Rendering after the first commit mounts the logic once for each open.
const [hasCommitted, setHasCommitted] = useState(false)
useEffect(() => setHasCommitted(true), [])
return hasCommitted ? <CommandKSearchPalette /> : null
}