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.

953 B
Raw Blame
import { LemonBanner } from '@posthog/lemon-ui'

export interface FeatureFlagNoConditionsWarningProps {
    conditionSetCount: number
    className?: string
}

// A flag with no release conditions matches nobody, so it always evaluates to false.
// Server-side SDKs that evaluate locally return that false without asking the PostHog
// API, so this warning makes the outcome visible where the conditions are shown.
export function FeatureFlagNoConditionsWarning({
    conditionSetCount,
    className,
}: FeatureFlagNoConditionsWarningProps): JSX.Element | null {
    if (conditionSetCount > 0) {
        return null
    }

    return (
        <LemonBanner type="warning" className={className} data-attr="feature-flag-no-conditions-warning">
            This flag has no release conditions, so it always evaluates to <code>false</code>. Add a condition set to
            release it, for example one set at 100% rollout.
        </LemonBanner>
    )
}