: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(data-warehouse): show error state when new-source list fails to load (#67233)
Tom Owersf22d554f7777
diff --git a/products/data_warehouse/frontend/scenes/NewSourceScene/NewSourceScene.tsx b/products/data_warehouse/frontend/scenes/NewSourceScene/NewSourceScene.tsxindex e3450c18c3ae..c7a969e62998 100644--- a/products/data_warehouse/frontend/scenes/NewSourceScene/NewSourceScene.tsx+++ b/products/data_warehouse/frontend/scenes/NewSourceScene/NewSourceScene.tsx@@ -88,13 +88,42 @@ export function NewSourceScene(): JSX.Element {const sceneRootLogic = newSourceSceneLogic()const { availableSources, availableSourcesLoading } = useValues(sceneRootLogic)- if (availableSourcesLoading || availableSources === null) {+ if (availableSourcesLoading) {return <LemonSkeleton />}+ if (availableSources === null) {+ return <AvailableSourcesError />+ }+return <MountedNewSourceScene availableSources={availableSources} />}+// The wizard endpoint failed (a timeout, a 5xx, or a 403 for members without data-source+// access). Without this the scene keeps rendering a bare skeleton indefinitely, which reads+// as a permanently stuck loading state.+function AvailableSourcesError(): JSX.Element {+ const { load } = useActions(availableSourcesLogic)++ return (+ <LemonBanner+ type="error"+ action={{+ children: 'Try again',+ // Retrying flips availableSourcesLoading, which swaps this banner for the+ // skeleton in the parent guard — so the retry state shows there, not here.+ onClick: () => void load(),+ }}+ >+ <p className="font-semibold mb-1">Couldn't load the list of available sources</p>+ <p className="m-0">+ This can happen if the request timed out or you don't have permission to manage data sources in this+ project. Try again, or ask an organization admin to check your access.+ </p>+ </LemonBanner>+ )+}+function MountedNewSourceScene({ availableSources }: { availableSources: Record<string, SourceConfig> }): JSX.Element {const sourceWizardLogicProps = useMemo(() => ({ availableSources }), [availableSources])const wizardLogic = sourceWizardLogic(sourceWizardLogicProps)@@ -150,10 +179,14 @@ interface NewSourcesWizardProps {export function NewSourcesWizard(props: NewSourcesWizardProps): JSX.Element {const { availableSources, availableSourcesLoading } = useValues(availableSourcesLogic)- if (availableSourcesLoading || availableSources === null) {+ if (availableSourcesLoading) {return <LemonSkeleton />}+ if (availableSources === null) {+ return <AvailableSourcesError />+ }+const sourceWizardLogicProps = {onComplete: props.onComplete,availableSources,