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(llm-analytics): show error state on sentiment API failure (#58405)

okxintde6e8782bdec
diff --git a/products/llm_analytics/frontend/tabs/LLMAnalyticsSentiment.tsx b/products/llm_analytics/frontend/tabs/LLMAnalyticsSentiment.tsx
index 0371ef1c83fe..3e731d86273e 100644
--- a/products/llm_analytics/frontend/tabs/LLMAnalyticsSentiment.tsx
+++ b/products/llm_analytics/frontend/tabs/LLMAnalyticsSentiment.tsx
@@ -312,6 +312,7 @@ export function LLMAnalyticsSentiment(): JSX.Element {
const {
generations,
generationsLoading,
+ generationsError,
groupedSentimentCards,
sentimentCards,
stillAnalyzing,
@@ -328,6 +329,11 @@ export function LLMAnalyticsSentiment(): JSX.Element {
<div className="flex items-center justify-center py-20">
<Spinner className="text-4xl" captureTime />
</div>
+ ) : generationsError ? (
+ <div className="text-center py-20 text-muted">
+ <p className="text-lg font-medium mb-1">Failed to load generations</p>
+ <p className="text-sm">There was an error fetching data. Try refreshing the page.</p>
+ </div>
) : generations.length === 0 ? (
<div className="text-center py-20 text-muted">
<p className="text-lg font-medium mb-1">No generations with user input found</p>
diff --git a/products/llm_analytics/frontend/tabs/llmAnalyticsSentimentLogic.ts b/products/llm_analytics/frontend/tabs/llmAnalyticsSentimentLogic.ts
index d605b24e2cb3..380c21ab6d17 100644
--- a/products/llm_analytics/frontend/tabs/llmAnalyticsSentimentLogic.ts
+++ b/products/llm_analytics/frontend/tabs/llmAnalyticsSentimentLogic.ts
@@ -304,6 +304,14 @@ export const llmAnalyticsSentimentLogic = kea<llmAnalyticsSentimentLogicType>([
loadGenerations: () => true,
},
],
+ generationsError: [
+ false as boolean,
+ {
+ loadGenerations: () => false,
+ loadGenerationsFailure: () => true,
+ loadGenerationsSuccess: () => false,
+ },
+ ],
}),
loaders(({ values }) => ({