: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(today): draw report charts without the Inbox detail logic (#109972)
Vojta Bartoš6c3ed9cb7c0b
diff --git a/frontend/src/scenes/project-homepage/today/Today.stories.tsx b/frontend/src/scenes/project-homepage/today/Today.stories.tsxindex 1a0623a308ee..7106feed4221 100644--- a/frontend/src/scenes/project-homepage/today/Today.stories.tsx+++ b/frontend/src/scenes/project-homepage/today/Today.stories.tsx@@ -21,6 +21,7 @@ import { mswDecorator } from '~/mocks/browser'import { EMPTY_PAGINATED_RESPONSE } from '~/mocks/handlers'import { makeReport, mockSignals } from 'products/signals/frontend/inbox/__mocks__/inboxMocks'+import { reportMetricQueryHandler } from 'products/signals/frontend/inbox/__mocks__/reportMetricMocks'import { SignalReportStatus } from 'products/signals/frontend/inbox/types'import { ChannelDTOApi, TaskListItemApi } from 'products/tasks/frontend/generated/api.schemas'import type { BriefingApi, BriefingItemApi } from 'products/today/frontend/generated/api.schemas'@@ -263,6 +264,44 @@ const REPORTS = [actionability: 'immediately_actionable',source_products: ['llm_analytics'],}),+ makeReport({+ id: 'report-4',+ title: 'Checkout conversion fell after the address form change',+ summary:+ 'Fewer people finish checkout since the address form gained a required phone field.\n\n[Checkout conversion](chart:checkout-conversion)\n\nThe drop is sharpest on mobile, where the field is hard to fill.',+ status: SignalReportStatus.READY,+ signal_count: 4,+ updated_at: '2026-09-28T08:00:00Z',+ priority: 'P1',+ actionability: 'immediately_actionable',+ source_products: ['product_analytics'],+ charts: [+ {+ chart_id: 'checkout-conversion',+ title: 'Checkout conversion',+ query: {+ kind: 'InsightVizNode',+ source: {+ kind: 'TrendsQuery',+ series: [{ kind: 'EventsNode', event: 'checkout completed' }],+ dateRange: { date_from: '2026-09-14', date_to: '2026-09-28' },+ },+ },+ },+ {+ chart_id: 'mobile-dropoff',+ title: 'Mobile drop-off at the address form',+ query: {+ kind: 'InsightVizNode',+ source: {+ kind: 'TrendsQuery',+ series: [{ kind: 'EventsNode', event: 'address form abandoned' }],+ dateRange: { date_from: '2026-09-14', date_to: '2026-09-28' },+ },+ },+ },+ ],+ }),]function briefingItem(overrides: Partial<BriefingItemApi> & Pick<BriefingItemApi, 'key' | 'label'>): BriefingItemApi {@@ -391,6 +430,7 @@ const meta: Meta = {200,REPORTS.find((report) => report.id === req.params.id) ?? REPORTS[0],],+ '/api/environments/:team_id/query/:kind/': reportMetricQueryHandler,'/api/projects/:team_id/signals/reports/:id/signals/': (req) => [200,// Error tracking signals fetch their issue, which these stories do not mock.@@ -548,6 +588,11 @@ export const ReportWithSuggestedPrompts: Story = {parameters: { pageUrl: urls.todayReport('report-2') },}+// One chart placed in the summary, one trailing it. Charts resolve without the Inbox detail logic.+export const ReportWithCharts: Story = {+ parameters: { pageUrl: urls.todayReport('report-4') },+}+export const SpacesPane: Story = {play: async ({ canvasElement }) => {await userEvent.click(await within(canvasElement).findByLabelText('Spaces'))diff --git a/frontend/src/scenes/project-homepage/today/TodayReportPage.tsx b/frontend/src/scenes/project-homepage/today/TodayReportPage.tsxindex ea9872e87f3b..b0ba03ff3295 100644--- a/frontend/src/scenes/project-homepage/today/TodayReportPage.tsx+++ b/frontend/src/scenes/project-homepage/today/TodayReportPage.tsx@@ -6,6 +6,7 @@ import { LemonButton, LemonSkeleton, LemonTag } from '@posthog/lemon-ui'import { urls } from 'scenes/urls'import { ReportChart } from 'products/signals/frontend/inbox/components/detail/ReportChart'+import { ReportChartsContext } from 'products/signals/frontend/inbox/components/detail/reportChartsContext'import { ReportSummaryBody } from 'products/signals/frontend/inbox/components/detail/ReportSummaryBody'import { TodayIcon } from './TodayIcon'@@ -18,7 +19,7 @@ import { reportIcon, reportMeta, reportSource, reportTitle } from './todaySignalexport function TodayReportPage({ reportId }: { reportId: string }): JSX.Element {const logic = todayReportLogic({ reportId })- const { currentReport, reportFailed, fullReportLoading, chartPlacements, trailingCharts, reportUrl } =+ const { currentReport, reportFailed, fullReportLoading, chartPlacements, chartsById, trailingCharts, reportUrl } =useValues(logic)const { loadFullReport } = useActions(logic)const sampleDisabledReason = isSampleReportId(reportId) ? 'This is a sample report.' : undefined@@ -94,16 +95,18 @@ export function TodayReportPage({ reportId }: { reportId: string }): JSX.ElementOpen in Inbox</LemonButton></div>- <div className="TodayReport__body">- {currentReport.summary ? (- <ReportSummaryBody summary={currentReport.summary} chartPlacements={chartPlacements} />- ) : (- <p>No summary yet. An agent is still investigating.</p>- )}- {trailingCharts.map((chart) => (- <ReportChart key={chart.chart_id} chartId={chart.chart_id} />- ))}- </div>+ <ReportChartsContext.Provider value={chartsById}>+ <div className="TodayReport__body">+ {currentReport.summary ? (+ <ReportSummaryBody summary={currentReport.summary} chartPlacements={chartPlacements} />+ ) : (+ <p>No summary yet. An agent is still investigating.</p>+ )}+ {trailingCharts.map((chart) => (+ <ReportChart key={chart.chart_id} chartId={chart.chart_id} />+ ))}+ </div>+ </ReportChartsContext.Provider></article><TodayReportEvidence reportId={currentReport.id} /><TodayReportPrompts report={currentReport} reportUrl={reportUrl} />diff --git a/frontend/src/scenes/project-homepage/today/todayReportLogic.ts b/frontend/src/scenes/project-homepage/today/todayReportLogic.tsindex 9508affa1306..1c5865e11990 100644--- a/frontend/src/scenes/project-homepage/today/todayReportLogic.ts+++ b/frontend/src/scenes/project-homepage/today/todayReportLogic.ts@@ -22,6 +22,7 @@ export interface TodayReportLogicProps {export interface todayReportLogicValues {reports: SignalReport[] // todayLogicchartPlacements: ChartPlacements+ chartsById: Map<string, ReportChartApi>currentReport: SignalReport | nullfullReport: SignalReport | nullfullReportLoading: boolean@@ -77,6 +78,7 @@ export interface todayReportLogicMeta {reportFailed: boolean) => SignalReport | nullchartPlacements: (currentReport: SignalReport | null) => ChartPlacements+ chartsById: (currentReport: SignalReport | null) => Map<string, ReportChartApi>trailingCharts: (currentReport: SignalReport | null, chartPlacements: ChartPlacements) => ReportChartApi[]signals: (reportSignals: SignalNodeApi[] | null) => SignalNodeApi[]}@@ -146,6 +148,11 @@ export const todayReportLogic = kea<todayReportLogicType>([(currentReport?.charts ?? []).map((chart) => chart.chart_id)),],+ chartsById: [+ (s) => [s.currentReport],+ (currentReport: SignalReport | null): Map<string, ReportChartApi> =>+ new Map((currentReport?.charts ?? []).map((chart) => [chart.chart_id, chart])),+ ],trailingCharts: [(s) => [s.currentReport, s.chartPlacements],(currentReport: SignalReport | null, chartPlacements: ChartPlacements): ReportChartApi[] =>diff --git a/products/signals/frontend/inbox/components/detail/ReportChart.test.tsx b/products/signals/frontend/inbox/components/detail/ReportChart.test.tsxnew file mode 100644index 000000000000..79ee36d54b5d--- /dev/null+++ b/products/signals/frontend/inbox/components/detail/ReportChart.test.tsx@@ -0,0 +1,36 @@+import '@testing-library/jest-dom'++import { render, screen } from '@testing-library/react'++import type { ReportChartApi } from 'products/signals/frontend/generated/api.schemas'++import { ReportChart } from './ReportChart'+import { ReportChartsContext } from './reportChartsContext'++jest.mock('~/queries/Query/Query', () => ({ Query: () => <div data-attr="query" /> }))++const CHART: ReportChartApi = {+ chart_id: 'signups-drop',+ title: 'Daily signups',+ query: { kind: 'InsightVizNode', source: { kind: 'TrendsQuery', series: [] } },+ caption: null,+ size: 'medium',+}++describe('ReportChart', () => {+ it('draws the chart from the charts in context, without the Inbox detail logic', () => {+ render(+ <ReportChartsContext.Provider value={new Map([[CHART.chart_id, CHART]])}>+ <ReportChart chartId="signups-drop" />+ </ReportChartsContext.Provider>+ )++ expect(screen.getByText('Daily signups')).toBeInTheDocument()+ })++ it('draws nothing for a chart the report does not have', () => {+ const { container } = render(<ReportChart chartId="signups-drop" />)++ expect(container).toBeEmptyDOMElement()+ })+})diff --git a/products/signals/frontend/inbox/components/detail/ReportChart.tsx b/products/signals/frontend/inbox/components/detail/ReportChart.tsxindex 7cc2a8ce487d..a365dc2b9dae 100644--- a/products/signals/frontend/inbox/components/detail/ReportChart.tsx+++ b/products/signals/frontend/inbox/components/detail/ReportChart.tsx@@ -1,5 +1,5 @@import { useValues } from 'kea'-import { useMemo } from 'react'+import { useContext, useMemo } from 'react'import { IconExternal } from '@posthog/icons'import { LemonButton } from '@posthog/lemon-ui'@@ -15,8 +15,8 @@ import { ChartDisplayType, InsightLogicProps } from '~/types'import type { ReportChartApi, SizeEnumApi } from 'products/signals/frontend/generated/api.schemas'-import { inboxReportDetailLogic } from '../../logics/inboxReportDetailLogic'import { chartOpenTarget } from '../../utils/chartOpenTarget'+import { ReportChartsContext } from './reportChartsContext'/*** Strip the chrome a query node carries for the insight scene (filter bar, header, results table)@@ -154,11 +154,10 @@ function SavedInsightChartBody({ query, uniqueKey }: { query: SavedInsightNode;* be handed something it cannot draw. That degrades to `Query`'s own error boundary rather than* taking the report down with it.*/-/** Looks the chart up on the open report. Replay Vision reads reports through its own- * scanner-scoped endpoint, so it renders `ReportChartCard` with the chart it already holds. */+/** Looks the chart up on the report being shown (`ReportChartsContext`). Replay Vision reads reports+ * through its own scanner-scoped endpoint, so it renders `ReportChartCard` with the chart it already holds. */export function ReportChart({ chartId }: { chartId: string }): JSX.Element | null {- const { chartsById } = useValues(inboxReportDetailLogic)- const chart = chartsById.get(chartId)+ const chart = useContext(ReportChartsContext).get(chartId)return chart ? <ReportChartCard chart={chart} /> : null}diff --git a/products/signals/frontend/inbox/components/detail/ReportDetail.tsx b/products/signals/frontend/inbox/components/detail/ReportDetail.tsxindex 7c2d08a2046d..922426556e3e 100644--- a/products/signals/frontend/inbox/components/detail/ReportDetail.tsx+++ b/products/signals/frontend/inbox/components/detail/ReportDetail.tsx@@ -49,6 +49,7 @@ import { PullRequestDiffPending, PullRequestDiffStat, PullRequestDiffStatSkeletoimport { PullRequestFilesChanged } from './PullRequestFilesChanged'import { ReportActivitySection } from './ReportActivitySection'import { ReportChart } from './ReportChart'+import { ReportChartsContext } from './reportChartsContext'import { ReportChecksSection } from './ReportChecksSection'import { useReportDetailActions } from './ReportDetailActions'import { ReportExpectedImpact } from './ReportExpectedImpact'@@ -232,6 +233,7 @@ export function InboxDetailFrame({evidenceExpanded,priorityExplanation,chartPlacements,+ chartsById,trailingCharts,detailTab,reportTaskToOpen,@@ -348,34 +350,36 @@ export function InboxDetailFrame({<div className="flex flex-1 flex-col gap-6">{titleHeading}- <div>- {report.summary ? (- <ReportSummaryBody- summary={report.summary}- chartPlacements={chartPlacements}- implementButton={implementButton}- pullRequestNote={pullRequestNote}- impactMetrics={impactMetrics}- expectedImpact={expectedImpact}- />- ) : (- <div className="flex flex-col gap-6">- <p className={`text-sm text-tertiary m-0${summaryPending ? ' italic' : ''}`}>- No summary yet. An agent is still investigating.- </p>- {pullRequestNote}- {impactMetrics}- {expectedImpact}- </div>- )}- {trailingCharts.length > 0 && (- <div className="flex flex-col gap-4 mt-5">- {trailingCharts.map((chart) => (- <ReportChart key={chart.chart_id} chartId={chart.chart_id} />- ))}- </div>- )}- </div>+ <ReportChartsContext.Provider value={chartsById}>+ <div>+ {report.summary ? (+ <ReportSummaryBody+ summary={report.summary}+ chartPlacements={chartPlacements}+ implementButton={implementButton}+ pullRequestNote={pullRequestNote}+ impactMetrics={impactMetrics}+ expectedImpact={expectedImpact}+ />+ ) : (+ <div className="flex flex-col gap-6">+ <p className={`text-sm text-tertiary m-0${summaryPending ? ' italic' : ''}`}>+ No summary yet. An agent is still investigating.+ </p>+ {pullRequestNote}+ {impactMetrics}+ {expectedImpact}+ </div>+ )}+ {trailingCharts.length > 0 && (+ <div className="flex flex-col gap-4 mt-5">+ {trailingCharts.map((chart) => (+ <ReportChart key={chart.chart_id} chartId={chart.chart_id} />+ ))}+ </div>+ )}+ </div>+ </ReportChartsContext.Provider>{/* The rating closes out the report body, pinned to the bottom of the column. */}<div className="mt-auto"><ReportFeedbackFooter report={report} align="end" />diff --git a/products/signals/frontend/inbox/components/detail/ReportDetailLegacy.tsx b/products/signals/frontend/inbox/components/detail/ReportDetailLegacy.tsxindex 2fdaf37a614d..427c4bf494d7 100644--- a/products/signals/frontend/inbox/components/detail/ReportDetailLegacy.tsx+++ b/products/signals/frontend/inbox/components/detail/ReportDetailLegacy.tsx@@ -53,6 +53,7 @@ import {} from './PullRequestDiffPanel'import { ReportActivitySection } from './ReportActivitySection'import { ReportChart } from './ReportChart'+import { ReportChartsContext } from './reportChartsContext'import { useReportDetailActions } from './ReportDetailActions'import { ReportFeedbackFooter } from './ReportFeedbackFooter'import { ReportTasksSection } from './ReportTasksSection'@@ -286,6 +287,7 @@ function InboxDetailFrameLegacy({priorityExplanation,actionabilityExplanation,chartPlacements,+ chartsById,trailingCharts,} = useValues(inboxReportDetailLogic(logicProps))const { expandEvidence, collapseEvidence } = useActions(inboxReportDetailLogic(logicProps))@@ -348,26 +350,28 @@ function InboxDetailFrameLegacy({collapsibleonToggleCollapsed={captureSectionToggle('summary')}>- {report.summary ? (- <LemonMarkdown- className="text-sm text-secondary leading-relaxed break-words [&>*+*]:mt-3 [&_[data-attr=report-chart]]:my-5 [&_li]:my-1 [&_ul]:my-2 [&_ol]:my-2 [&_h1]:mt-5 [&_h2]:mt-5 [&_h3]:mt-4"- disableImages- renderChartRef={renderChartRef}- >- {report.summary}- </LemonMarkdown>- ) : (- <p className={`text-sm text-tertiary m-0${summaryPending ? ' italic' : ''}`}>- No summary yet. An agent is still investigating.- </p>- )}- {trailingCharts.length > 0 && (- <div className="flex flex-col gap-4 mt-5">- {trailingCharts.map((chart) => (- <ReportChart key={chart.chart_id} chartId={chart.chart_id} />- ))}- </div>- )}+ <ReportChartsContext.Provider value={chartsById}>+ {report.summary ? (+ <LemonMarkdown+ className="text-sm text-secondary leading-relaxed break-words [&>*+*]:mt-3 [&_[data-attr=report-chart]]:my-5 [&_li]:my-1 [&_ul]:my-2 [&_ol]:my-2 [&_h1]:mt-5 [&_h2]:mt-5 [&_h3]:mt-4"+ disableImages+ renderChartRef={renderChartRef}+ >+ {report.summary}+ </LemonMarkdown>+ ) : (+ <p className={`text-sm text-tertiary m-0${summaryPending ? ' italic' : ''}`}>+ No summary yet. An agent is still investigating.+ </p>+ )}+ {trailingCharts.length > 0 && (+ <div className="flex flex-col gap-4 mt-5">+ {trailingCharts.map((chart) => (+ <ReportChart key={chart.chart_id} chartId={chart.chart_id} />+ ))}+ </div>+ )}+ </ReportChartsContext.Provider></DetailSection>{summaryFooter}{/* The rating closes out the report body, where the reading ends – ahead of thediff --git a/products/signals/frontend/inbox/components/detail/reportChartsContext.ts b/products/signals/frontend/inbox/components/detail/reportChartsContext.tsnew file mode 100644index 000000000000..cff0572f14dc--- /dev/null+++ b/products/signals/frontend/inbox/components/detail/reportChartsContext.ts@@ -0,0 +1,10 @@+import { createContext } from 'react'++import type { ReportChartApi } from 'products/signals/frontend/generated/api.schemas'++/**+ * The charts of the report on screen, by chart id. Whoever renders a report body provides it, so a+ * `chart:` reference in the summary resolves wherever the body appears, in the Inbox or on Today,+ * without that surface having to mount the Inbox detail logic.+ */+export const ReportChartsContext = createContext<ReadonlyMap<string, ReportChartApi>>(new Map())