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.

673 B
Raw Blame
/**
 * Render a raw HogQL result value as plain text for the preview table.
 *
 * LemonTable treats any non-null, non-element object cell as a cell representation and spreads its
 * `props` onto the `<td>`, so a value shaped like `{ props: { dangerouslySetInnerHTML } }` would
 * inject markup. Stringifying objects and arrays keeps every cell a primitive, which also stops
 * array/object columns from rendering as blank cells.
 */
export function formatPreviewCell(value: unknown): string {
    if (value === null || value === undefined) {
        return ''
    }
    if (typeof value === 'object') {
        return JSON.stringify(value)
    }
    return String(value)
}