: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
fix(logs): show error state in drop-rule preview instead of infinite spinner (#65688)
Daniel Visca3575ac97bcd1
diff --git a/products/logs/frontend/components/LogsSampling/LogsSamplingForm.tsx b/products/logs/frontend/components/LogsSampling/LogsSamplingForm.tsxindex 6340b19ed126..823e45f62507 100644--- a/products/logs/frontend/components/LogsSampling/LogsSamplingForm.tsx+++ b/products/logs/frontend/components/LogsSampling/LogsSamplingForm.tsx@@ -1,7 +1,7 @@import { useActions, useValues } from 'kea'import { useMemo } from 'react'-import { LemonInput, LemonSegmentedButton, LemonSelect, LemonSwitch } from '@posthog/lemon-ui'+import { LemonButton, LemonInput, LemonSegmentedButton, LemonSelect, LemonSwitch } from '@posthog/lemon-ui'import { dataColorVars } from 'lib/colors'import { Sparkline, SparklineReferenceLine, SparklineTimeSeries } from 'lib/components/Sparkline'@@ -106,7 +106,7 @@ function formatBytes(bytes: number): string {export function LogsSamplingForm(): JSX.Element {const { samplingForm, samplingFormErrors, filterPreview, filterPreviewLoading } = useValues(logsSamplingFormLogic)- const { setSamplingFormValue } = useActions(logsSamplingFormLogic)+ const { setSamplingFormValue, refreshFilterPreview } = useActions(logsSamplingFormLogic)const isRateLimit = samplingForm.rule_type === RuleTypeEnumApi.RateLimitconst hasFilters = samplingForm.filter_group.values.length > 0@@ -224,7 +224,7 @@ export function LogsSamplingForm(): JSX.Element {<div className="h-full flex items-center justify-center text-muted text-xs">Add a filter above to preview matching log volume</div>- ) : filterPreviewLoading || !filterPreview ? (+ ) : filterPreviewLoading ? (<Sparklinedata={[]}labels={[]}@@ -232,6 +232,13 @@ export function LogsSamplingForm(): JSX.Element {className="w-full h-full"maximumIndicator={false}/>+ ) : !filterPreview ? (+ <div className="h-full flex flex-col gap-1 items-center justify-center text-muted text-xs">+ <span>Couldn't load the volume preview.</span>+ <LemonButton size="xsmall" type="secondary" onClick={refreshFilterPreview}>+ Retry+ </LemonButton>+ </div>) : series.length === 0 ? (<div className="h-full flex items-center justify-center text-muted text-xs">No logs match these filters in the last 24h