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.

869 B
Raw Blame
import { Suspense } from 'react'

import { Spinner } from 'lib/lemon-ui/Spinner'
import { lazyWithRetry } from 'lib/utils/retryImport'

import type { CodeEditorProps } from './CodeEditorImpl'

export type { CodeEditorProps } from './CodeEditorImpl'
export { clearLogicReference, initModel } from './modelLogicReference'

const LazyCodeEditor = lazyWithRetry(() => import('./CodeEditorImpl').then((m) => ({ default: m.CodeEditor })))

/** Lazy facade so importing CodeEditor doesn't pull monaco (~4 MB) into the importer's chunk. */
export function CodeEditor(props: CodeEditorProps): JSX.Element {
    return (
        <Suspense
            fallback={
                <div className="CodeEditor relative h-full w-full">
                    <Spinner />
                </div>
            }
        >
            <LazyCodeEditor {...props} />
        </Suspense>
    )
}