fix(llm-analytics): show error state on sentiment API failure - #58405
Merged
carlos-marchal-ph merged 1 commit intoMay 21, 2026
Conversation
When the generations API returns a server error, the kea loader dispatches loadGenerationsFailure but the generations state stays as [], which the UI interprets as "no data" and shows a misleading empty state message. Add a generationsError reducer that is set on loadGenerationsFailure and cleared on loadGenerations/loadGenerationsSuccess. Update the sentiment component to render a distinct error message when the load failed, so users know to refresh rather than think there is no data. Closes PostHog#58341
Contributor
|
Reviews (1): Last reviewed commit: "fix(llm-analytics): show error state on ..." | Re-trigger Greptile |
Contributor
|
This PR hasn't seen activity in a week! Should it be merged, closed, or further worked on? If you want to keep it open, please remove the |
carlos-marchal-ph
approved these changes
May 21, 2026
carlos-marchal-ph
enabled auto-merge (squash)
May 21, 2026 15:04
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
When the sentiment generations endpoint (
/api/environments/{id}/llm_analytics/sentiment/generations/) returns a 500 error, the kea loader dispatchesloadGenerationsFailurebut thegenerationsstate stays as[]. The UI treatsgenerations.length === 0as "no data" and renders the empty-state copy ("No generations with user input found"), which misleads users into thinking there is simply nothing to show rather than signalling that something went wrong.Closes #58341
Changes
llmAnalyticsSentimentLogic.ts— addgenerationsErrorreducer:trueonloadGenerationsFailurefalseonloadGenerations(new fetch started) andloadGenerationsSuccessLLMAnalyticsSentiment.tsx— checkgenerationsErrorbefore the empty-state branch:How did you test this code?
Traced the kea loader lifecycle: loaders dispatch
*Failureactions on thrown errors; kea does not expose a built-in error state on the generated selectors, so the new reducer is the standard kea pattern for this. Ran the frontend formatter (passed).Publish to changelog?
No
Docs update
No docs change needed.
🤖 Agent context
Identified the gap by reading the loader definition and the UI branch:
generations === []covered both the "no data" and "load failed" cases with identical copy. Added a minimal reducer to distinguish the two states without touching the loader logic or the fetch function.