: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(aio): guard null query response in sentiment generations fetch (#69427)
Radu Raicea0ada631a5b24
diff --git a/products/ai_observability/frontend/sentimentQueries.ts b/products/ai_observability/frontend/sentimentQueries.tsindex cd6a65eff6bf..6824873d8cb9 100644--- a/products/ai_observability/frontend/sentimentQueries.ts+++ b/products/ai_observability/frontend/sentimentQueries.ts@@ -172,7 +172,7 @@ async function queryStoredGenerationSentiments()const sentimentByTargetId = new Map<string, GenerationSentiment>()- for (const row of response.results || []) {+ for (const row of response?.results || []) {const [, generationId, label, score, scores, messages, messageCount] = rowconst normalized = normalizeSentimentResult({label,@@ -279,7 +279,7 @@ async function queryGenerationInputs()const inputs = new Map<string, unknown>()- for (const [uuid, , aiInput] of response.results || []) {+ for (const [uuid, , aiInput] of response?.results || []) {if (uuid && hasUsableInput(aiInput)) {inputs.set(String(uuid), aiInput)}@@ -338,7 +338,7 @@ export async function fetchSentimentGenerationsPage(}const response = await api.query(generationsQuery)- const generationRows = (response.results || [])+ const generationRows = (response?.results || []).map((row) => mapGenerationRow(row)).filter((row): row is SentimentGeneration => row !== null)@@ -361,6 +361,6 @@ export async function fetchSentimentGenerationsPage(sentiment: sentimentByGenerationKey[generation.uuid] ?? null,})).filter((generation) => generation.sentiment !== null),- rawCount: response.results?.length ?? 0,+ rawCount: response?.results?.length ?? 0,}}