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.3 KB
Raw Blame
import { ReactNode, Suspense } from 'react'

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

import type { EmbeddedTaskComposerImplProps } from '../scenes/TaskTracker/components/EmbeddedTaskComposerImpl'

export type EmbeddedTaskComposerProps = EmbeddedTaskComposerImplProps & {
    /** Shown while the composer chunk loads. A host passes a placeholder shaped like the composer. */
    fallback?: ReactNode
}

// The composer pulls in the TaskTracker scene logic and its pickers, so it loads on demand. A host that
// only imports this module keeps its own chunk light.
const Lazy = lazyWithRetry(() =>
    import('../scenes/TaskTracker/components/EmbeddedTaskComposerImpl').then((m) => ({
        default: m.EmbeddedTaskComposerImpl,
    }))
)

/** The new-task composer (repository, mode, model and effort pickers, attachments, context) without the run view. */
export function EmbeddedTaskComposer({ fallback, ...props }: EmbeddedTaskComposerProps): JSX.Element {
    return (
        <Suspense
            fallback={
                fallback ?? (
                    <div className="flex items-center justify-center py-6">
                        <Spinner className="text-2xl" />
                    </div>
                )
            }
        >
            <Lazy {...props} />
        </Suspense>
    )
}