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.

fix(ml_inference): show a spinner, not a 404, until feature flags arrive (#105293)

Robbiec5022f438c33
diff --git a/products/ml_inference/frontend/DecisionPlaygroundScene.tsx b/products/ml_inference/frontend/DecisionPlaygroundScene.tsx
index aac315cba962..7a51df7533f1 100644
--- a/products/ml_inference/frontend/DecisionPlaygroundScene.tsx
+++ b/products/ml_inference/frontend/DecisionPlaygroundScene.tsx
@@ -9,12 +9,14 @@ import {
LemonSelect,
LemonTable,
LemonTextArea,
+ Spinner,
} from '@posthog/lemon-ui'
import { NotFound } from 'lib/components/NotFound'
import { FEATURE_FLAGS } from 'lib/constants'
import { featureFlagLogic } from 'lib/logic/featureFlagLogic'
import { CodeEditorResizeable } from 'lib/monaco/CodeEditorResizable'
+import { appLogic } from 'scenes/appLogic'
import { preflightLogic } from 'scenes/PreflightCheck/preflightLogic'
import { SceneExport } from 'scenes/sceneTypes'
@@ -49,8 +51,9 @@ const QUESTIONS_VIEW_OPTIONS: { value: QuestionsView; label: string }[] = [
]
export function DecisionPlaygroundScene(): JSX.Element {
- const { featureFlags } = useValues(featureFlagLogic)
+ const { featureFlags, receivedFeatureFlags } = useValues(featureFlagLogic)
const { preflight } = useValues(preflightLogic)
+ const { featureFlagsTimedOut } = useValues(appLogic)
const {
state,
questions,
@@ -77,7 +80,12 @@ export function DecisionPlaygroundScene(): JSX.Element {
// The same rule as the API: the flag enrols a project, and local development needs no flag.
if (!featureFlags[FEATURE_FLAGS.ML_INFERENCE_DECISIONS] && !preflight?.is_debug) {
- return <NotFound object="page" />
+ // An unset flag before the first flags response is unknown, not off, so the 404 waits for the answer or the app's flag timeout.
+ return receivedFeatureFlags || featureFlagsTimedOut ? (
+ <NotFound object="page" />
+ ) : (
+ <Spinner className="text-3xl mx-auto my-8" />
+ )
}
const answerRows = decision