feat(inbox): render report charts in the detail view - #3979
Draft
posthog[bot] wants to merge 1 commit into
Draft
Conversation
Reports can carry charts, and the summary places one where it writes a `[label](chart:<id>)` link. The desktop client dropped the field entirely, so readers saw the link label as dead text and lost the chart-based evidence. Adds the `charts` contract to `SignalReport`, a portable summary/chart layout pass in core, and a read-only chart renderer in the inbox detail view. Desktop has a charting library but no insight-visualization stack, so it draws the query shapes that map onto it — trends line/bar, BoldNumber, SQL result grids — and for the rest keeps the chart's title, caption, and a link to the report in PostHog rather than dropping the evidence silently. Chart queries are executed against `/query/`, so normalization is a trust boundary: a chart with no id, an unrenderable query kind, or an executable node nested in its query is dropped before it can reach the endpoint. Generated-By: PostHog Code Task-Id: c766bf25-1e2c-4eda-af9c-b111b3c15064
|
Merging to
After your PR is submitted to the merge queue, this comment will be automatically updated with its status. If the PR fails, failure details will also be posted here |
|
React Doctor found 2 issues in 2 files · 2 warnings. 2 warnings
Reviewed by React Doctor for commit |
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
Reports can carry charts, and a report summary places one inline where it writes a
[label](chart:<id>)link. The desktop client discarded thechartsfield entirely, so a chart-backed report rendered the link label as dead text and the chart evidence never appeared at all — it was only visible on web.Why: raised from a Self-driving inbox parity report — desktop was silently dropping evidence that reports had gone to the trouble of drawing.
Changes
@posthog/shared):ReportChart+chartsonSignalReport, with the backend's id/title/caption limits.@posthog/api-client): report reads normalizecharts. A chart'squerygets POSTed to/api/projects/:id/query/to draw it, so a chart with a missing/malformed id, a query kind we don't render, or an executable node (HogQuery,bytecode, …) nested anywhere inside it is dropped before it can reach the endpoint. Malformed entries drop individually — one bad chart doesn't cost the report its other charts. AddsrunInsightQuerybeside the existingrunHogQLQuery.@posthog/core):layoutReportSummarysplits a summary into prose and the charts it places, so a chart renders as a block instead of being nested inside a<p>. Only a paragraph consisting solely of chart references places charts; a reference in a sentence, list item, table cell, or code fence stays as its label text, as on web.@posthog/ui): a read-only chart card in the report detail view. Charts the summary never references render after the prose.Desktop has a charting library but no insight-visualization stack, so it draws what maps cleanly onto it — trends line/bar, BoldNumber, SQL result grids — and for anything else (funnels, retention, paths, saved insights, world maps) keeps the title and caption and offers the report in PostHog. Unsupported and failed charts degrade visibly rather than disappearing.
Reports with no charts render exactly as before.
How did you test this?
pnpm typecheck— clean across all 24 packages.pnpm --filter @posthog/shared --filter @posthog/api-client --filter @posthog/core --filter @posthog/ui test— 6,185 passing, including 56 new tests over the layout pass, query-shape planning, response shaping, and the chart-normalization gate (id/title validation, unrenderable kinds, nested executable nodes, per-entry drops, duplicate ids, the list cap).biome checkclean; zeronoRestrictedImportsin core;check-host-boundaries.mjsreports no new violations.chartsarray to render against — the drawing itself is unexercised against live data and wants a look before this leaves draft.Mobile is untouched;
@posthog/quill-chartsis canvas-based and won't run on React Native, so that treatment needs its own change. The shared contract this adds is what it would build on.Automatic notifications
Created with PostHog Code from an inbox report