: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
feat(error-tracking): add issue filter previews (#82813)
Hugues Pouillot0b4cb8fd7aee
diff --git a/frontend/snapshots.yml b/frontend/snapshots.ymlindex d5554e2ae07d..584ebbb68f23 100644--- a/frontend/snapshots.yml+++ b/frontend/snapshots.yml@@ -2093,7 +2093,7 @@ snapshots:errortracking-volumesparkline--compact-issues-list--light:hash: v1.k794b7964.24c7b32430b53240b2dd850722f89c410377ae29d1c89ba93bd860b581d787c1.bHZSqU3ooYQagaYxml8Rtj7ddEAekUWSvCyFshr-0mUerrortracking-volumesparkline--detailed-full-axis-with-events--dark:- hash: v1.k794b7964.2835aaf6d0a00660ad0265d6d4aab1c3ba9f1bb81717f5da401d82d3717c62fa.3Rdqrgs7RL2Z-a35fc6U5AKb6T50iHdQlQf2i-2adjw+ hash: v1.k794b7964.96f32cb9588280eab1e9272fa66be3efc38aa4dfb5a80818f1d59ff1eded175d.Ver_BIatDcyCrBovUXL1yMLQsRYQ3kAq89yiRwAaXuwerrortracking-volumesparkline--detailed-full-axis-with-events--light:hash: v1.k794b7964.bdbb4d8591a096fa9da4adc0e99d5ce240f7aaa49783f2d3b9df1bdfceea03bb.gtH820unXuGFwObQJt1i0pKq94v8gHJ5ghayzNzR2L4errortracking-volumesparkline--detailed-mostly-zeros--dark:@@ -2101,9 +2101,9 @@ snapshots:errortracking-volumesparkline--detailed-mostly-zeros--light:hash: v1.k794b7964.4c5e28989a0459c30a10cfd4b094eb968b2c7f8a90d2b4150b68fd07e1f0d723.p9TXOg4rWilz8F-xPv4MTWAdoeuTfC168hULwamX26Yerrortracking-volumesparkline--detailed-overlapping-event-dates--dark:- hash: v1.k794b7964.4ab38321e69e8fc2d0cba4cf5735e986395b2b6bf682088a2170d0dd2f6095db.OnHNv-QrV47cKSm_C-vQMZ92cOPUJkMKpYxM0jHquCU+ hash: v1.k794b7964.a33d4baeba04bdd20655dec4bb3fa9272ce68c23420fca7729131ca32cd4fa78.H5bkYtG8BvpwwK1H8fztjb-KKLdl8l35ntvHjimkjiserrortracking-volumesparkline--detailed-overlapping-event-dates--light:- hash: v1.k794b7964.a3f1dcacb05c167c43e757780833b5a9d9baf69d07b351d42da10a67d700471e.ozDWA4W8l6ZIHgGKSwJhMX3XMyvdxrupTAD2pEX6A5I+ hash: v1.k794b7964.1d48520350e38b59ea82b5f689adad75a9f8a5c73640b0a925cd3b1112f258ef.gKQr3FNAuaTUmRioU4GpVKS2ttQDyU4kHMijdijxTGgerrortracking-volumesparkline--detailed-with-spikes--dark:hash: v1.k794b7964.38b18635463fb7c345dbd87b10427e3e3b2206a3028b9f50709101db4bd8bcdf.hpwsjAr0rlWsXptEPCxgNScbKOgBvCgZDsKaOWmvXAcerrortracking-volumesparkline--detailed-with-spikes--light:@@ -2113,7 +2113,7 @@ snapshots:errortracking-volumesparkline--detailed-zeros-and-ones--light:hash: v1.k794b7964.b7d1f95e1492bdc399321cc8de1a7c7ee95a421aaf1135717eef2233f0f36621.bSKXY_IbYl5PLJnhRFt2jAelLAPgBH1suxwc-R9h75werrortracking-volumesparkline--events-before-data-range--dark:- hash: v1.k794b7964.d59e36f12a812ad81bfe87a667bac644ccd806ec7ef08bba8406c56c4c384275.UiTTwDxfntJBUdYNxiPU-1zQWfGwMIfxVvEy97dhcsk+ hash: v1.k794b7964.3c5dc7169c8ef603ef9fde739c8ec72b9f6d82ae27e6d7146acec292fb1a57da.XfncZGjCCE_4kAC87cuQ77aVPw0MrdsHlCUZl7hkf2werrortracking-volumesparkline--events-before-data-range--light:hash: v1.k794b7964.124227295a3079c9a271b5b1b1de997d8f1a9b536928ac8fc0e5e806afd2f8f5.9CCTbFhZMpAVVger6Xuyp0kXNjRjdlk9vf1PwtmZEZwexperiments-varianttimeseriestooltip--pending-day--dark:@@ -6057,17 +6057,41 @@ snapshots:scenes-app-error-project-unavailable--no-selectable-projects--light:hash: v1.k794b7964.25cba9f347696eb78fc20a05e5f37e514e17b483c0e7f2cbc2a0ff581eef2b72.Z1uJTP8R_ATm8aciECP4ScSzcSTFpYd7VQI6kVswSMgscenes-app-errortracking--group-page--dark:- hash: v1.k794b7964.b4f89cf9690d8df054891eba1029f4d112d728b225eeabf08b7af55a6b2bfaeb.M_qwMNwyJCeDhm5pVXjP8iinNvsKneE4st4R9asrbpM+ hash: v1.k794b7964.535b839d5db78b5f0f8795138247d80510a424396dfcf4c0340879b1b648acc0.iMjTx1ns3YJ7xVddwdfL2laNWuyhwbgglZNI0yz3MJkscenes-app-errortracking--group-page--light:- hash: v1.k794b7964.01fbb3dd6df45045087dfb63c4d6648ad7b91d9e9e04a98c84757a11f8d0bae2.DiXK3fovaZKZurualgSciuqWpXupscK9DsYT0kWpm1I+ hash: v1.k794b7964.aa7c14dc58c672d210f74c8b4c9c608e3192b6e4bccf4e599185a2d42bc9bb27.5S5A2vxw6z0zUJQYKs0g0quETICkW1bq5iQ0u7sNGQ0+ scenes-app-errortracking--group-page-breakdown-loading--dark:+ hash: v1.k794b7964.01db66903e15c4f8283753c71a80353c7042ec6e7b4873daaba7779cd612406b.yW-IzkeZrpTUmY8-1w5u7I1MLqdt1dBngnQarw90X24+ scenes-app-errortracking--group-page-breakdown-loading--light:+ hash: v1.k794b7964.25bb3a13b57bfb6c6aee29e4f167fa6b80363f6d45413a1d39123f464f8a3c64.ELac92gY9t1xI8Abu5Jj8wF0g8fPa_Fko5JAW5AlR9Y+ scenes-app-errortracking--group-page-breakdown-modal--dark:+ hash: v1.k794b7964.4fa717b9f5fda558b34d0162f6cea3910aef933081b3c58ff9c1de1226ecff02.cIJnIklFol34MtGhs_8j4N3A-kPN1ps5npX0KmLTVR4+ scenes-app-errortracking--group-page-breakdown-modal--light:+ hash: v1.k794b7964.5315145b31df6124c949df95da8db106750f6d618a4b0d7c18f595bcfb32731f.FfLGfyyvB5SRqLFL1wWhElc5ztIwlP16xIuGSjTFS4A+ scenes-app-errortracking--group-page-breakdown-modal-loading--dark:+ hash: v1.k794b7964.c22f13833d276440896ad2f86fc796810477e0cb643ef7f4fca31fbf15fe5f16.tcEdSoSs9KFCVtON7XiN7geVD59VFejjNJhIEfEudWk+ scenes-app-errortracking--group-page-breakdown-modal-loading--light:+ hash: v1.k794b7964.1bb5ab9fdc5011a442b9ab57469243a05890970824bad0a7e712e2dd8818b7cb.kA0pf0RgM0-IMze-cuAAJBPAo0oInmQgNA-IqTcfWnU+ scenes-app-errortracking--group-page-capped-breakdown-panel--dark:+ hash: v1.k794b7964.9ccee9ad68e3ede8c393148e320095abbb1149ccae67579896a9e29bc34fd3b3.Nv1AMYSVRBPdexhp7-vPT5FPtVxz7vVFFKjuwuY2tr0+ scenes-app-errortracking--group-page-capped-breakdown-panel--light:+ hash: v1.k794b7964.4a7f2783ce0682c7f4ac03020388683f021a77249a1ee9ff5650236c4256336c.6OyLSmlED6PaLfpwYglRdbFViSfsR3Fmm-srGigFg0Y+ scenes-app-errortracking--group-page-content-sized-breakdown-panel--dark:+ hash: v1.k794b7964.9ccee9ad68e3ede8c393148e320095abbb1149ccae67579896a9e29bc34fd3b3.wwxRR0mrgoNXo2zrb6IJffG-5DlhqOkMFLHaOF2ppmc+ scenes-app-errortracking--group-page-content-sized-breakdown-panel--light:+ hash: v1.k794b7964.23c11585901a2f176686d2e6c6d4b9a1c92502abf9a96ffd3e46db1b914b30bb.5N-OGAvElIp7pSfsCWm6qEBvFClPyIa281sicWTMaIE+ scenes-app-errortracking--group-page-empty-with-filter--dark:+ hash: v1.k794b7964.1f009b93a01130bd93accaeaa6ee55edc8c580e5cbad15087c1396c7e2294e7c.1Q1ckK6SJ-Zw_pwA_0l0sWUz2iAguRYg-KRrlgUfP0U+ scenes-app-errortracking--group-page-empty-with-filter--light:+ hash: v1.k794b7964.4be7b425ec908e8420f831610c88cc213521769413e9735b868469961481dec2.3sqduQwEKll-3OCsNz5QGLjnpY7wJ-AN3FoTQVGn4Lsscenes-app-errortracking--group-page-loading--dark:- hash: v1.k794b7964.657207ec087926384dc6f6df591193ea9ce11f1d76019b9888a84889f4309302.qkMCILWJ4GNwGj7qef5t2f796ZEJVYxXONyAU6MOLyQ+ hash: v1.k794b7964.5cfd8c1f879bcd07eaf807dcebca2d59b4a891d82c393454ac97305b351a0bc1.qDhZGsjJQBMxq3aT5BqTIVTTmSy2E8-vK3LaJlkWU34scenes-app-errortracking--group-page-loading--light:- hash: v1.k794b7964.01724131c2ac110b1fb2739f9d26d641c1d4c1a45ae27926c52fb5290976d3ef.dQxMiBcI0_7M_bNbHO0TGpKkHQkbOzWIflVq1i6VB9E+ hash: v1.k794b7964.72089c4bfe3afee3f5c9477a69f1420ae8c12d624b2a6c57411c637338b9fca4.NdsmnmKg09omRIkuY1mnjDfxXpbBc6To6kSP1mUFUlQscenes-app-errortracking--group-page-with-self-driving--dark:- hash: v1.k794b7964.fc3b7d5ed9c5e3ea67982bf105f38bd5a181b99d94bf71ed8d56b881f27fd120.nw5TFcSDe6Om74BgneMn8nc_GUAyTJatIzfRtVvDmIg+ hash: v1.k794b7964.dbd7d3f7f3255f3657098204f34b9b026888ce251843a42763ad1fd01b9516c0.1UCE29AB0s8X6ObQRp8Src1S0P7xT2R7ilA3EqPST4sscenes-app-errortracking--group-page-with-self-driving--light:- hash: v1.k794b7964.1e983ebbcfb9994db466338e4ad071b58b4887e43d3fb4d581cee942eb230fe4.f9T2y4DXRcp72GQaSZOcXG4nifbVU_NnyDbJekoYskE+ hash: v1.k794b7964.7c0d8cad2883cba67185a12f8c9d6bb930a9441dac9bc0ba161b0c00ff0b7f57.GHGSAxJO5d7BPYnc1GODWSE9AjPVQg4_oji_JgKrEokscenes-app-errortracking--list-page--dark:hash: v1.k794b7964.f474d0d6caf49e7b9a4cfd469546ab9de031039030fb9da704293bc40d87e69a.WxsvGwytEdwdnq8_Ywy_dgGBBYoSYCX9hX72AB42bgsscenes-app-errortracking--list-page--light:diff --git a/packages/quill/packages/charts/src/overlays/DefaultTooltip.test.tsx b/packages/quill/packages/charts/src/overlays/DefaultTooltip.test.tsxindex 9caa52d94b9f..c7c6345ad07b 100644--- a/packages/quill/packages/charts/src/overlays/DefaultTooltip.test.tsx+++ b/packages/quill/packages/charts/src/overlays/DefaultTooltip.test.tsx@@ -266,5 +266,16 @@ describe('DefaultTooltip', () => {expect(closest).toHaveLength(1)expect(closest[0].querySelector('[data-attr="hog-chart-tooltip-series"]')?.textContent).toBe('Beta')})++ it('marks the hovered series row before using the cursor position', () => {+ const withYPixel: TooltipContext['seriesData'] = [+ { ...TWO_SERIES[0], yPixel: 0 },+ { ...TWO_SERIES[1], yPixel: 300 },+ ]+ renderTooltip({}, withYPixel, { hoveredSeriesKey: 'b', hoverPosition: { x: 0, y: 0 } })+ const closest = document.querySelectorAll<HTMLElement>('[data-closest="true"]')+ expect(closest).toHaveLength(1)+ expect(closest[0].querySelector('[data-attr="hog-chart-tooltip-series"]')?.textContent).toBe('Beta')+ })})})diff --git a/packages/quill/packages/charts/src/overlays/DefaultTooltip.tsx b/packages/quill/packages/charts/src/overlays/DefaultTooltip.tsxindex 657a8abccf0b..663b8c86d5f8 100644--- a/packages/quill/packages/charts/src/overlays/DefaultTooltip.tsx+++ b/packages/quill/packages/charts/src/overlays/DefaultTooltip.tsx@@ -52,6 +52,7 @@ export function DefaultTooltip<Meta = unknown>({label,seriesData,hoverPosition,+ hoveredSeriesKey,valueFormatter,labelFormatter,labelRenderer,@@ -72,7 +73,9 @@ export function DefaultTooltip<Meta = unknown>({? [...visible].sort((a, b) => (a.yPixel ?? Infinity) - (b.yPixel ?? Infinity)): visibleconst summable = rows.filter((s) => !s.series.overlay && s.series.visibility?.total !== false)- const closestKey = hoverPosition != null && rows.length > 1 ? findClosestSeriesKey(rows, hoverPosition.y) : null+ const closestKey =+ hoveredSeriesKey ??+ (hoverPosition != null && rows.length > 1 ? findClosestSeriesKey(rows, hoverPosition.y) : null)const renderTotal = showTotal && summable.length > 1const total = summable.reduce((acc, s) => acc + s.value, 0)const formatTotal = totalFormatter ?? ((value: number): React.ReactNode => format(value, summable[0]))diff --git a/products/error_tracking/backend/hogql_queries/error_tracking_breakdowns_query_runner.py b/products/error_tracking/backend/hogql_queries/error_tracking_breakdowns_query_runner.pyindex ad6a9d540cdf..9b1bf0e12e5a 100644--- a/products/error_tracking/backend/hogql_queries/error_tracking_breakdowns_query_runner.py+++ b/products/error_tracking/backend/hogql_queries/error_tracking_breakdowns_query_runner.py@@ -54,12 +54,32 @@ class ErrorTrackingBreakdownsQueryRunner(def to_query(self) -> ast.SelectQuery:array_elements: list[ast.Expr] = []for prop in self.query.breakdownProperties:+ property_value: ast.Expr = ast.Field(chain=["properties", prop])+ if "%" in prop:+ raw_property_value = ast.Call(+ name="JSONExtractRaw",+ args=[ast.Field(chain=["properties"]), ast.Constant(value=prop)],+ )+ property_value = ast.Call(+ name="replaceRegexpAll",+ args=[+ ast.Call(+ name="nullIf",+ args=[+ ast.Call(name="nullIf", args=[raw_property_value, ast.Constant(value="")]),+ ast.Constant(value="null"),+ ],+ ),+ ast.Constant(value='^"|"$'),+ ast.Constant(value=""),+ ],+ )tuple_elements = [ast.Constant(value=prop),ast.Call(name="ifNull",args=[- ast.Call(name="toString", args=[ast.Field(chain=["properties", prop])]),+ ast.Call(name="toString", args=[property_value]),ast.Constant(value=BREAKDOWN_NULL_STRING_LABEL),],),diff --git a/products/error_tracking/backend/hogql_queries/test/test_error_tracking_breakdowns_query_runner.py b/products/error_tracking/backend/hogql_queries/test/test_error_tracking_breakdowns_query_runner.pyindex cc11f1b859af..883ebb52977c 100644--- a/products/error_tracking/backend/hogql_queries/test/test_error_tracking_breakdowns_query_runner.py+++ b/products/error_tracking/backend/hogql_queries/test/test_error_tracking_breakdowns_query_runner.py@@ -80,6 +80,29 @@ class TestErrorTrackingBreakdownsQueryRunner(ClickhouseTestMixin, APIBaseTest):assert browser_data.values[2].value == "C"assert browser_data.values[2].count == 6+ @freeze_time("2024-01-10T12:00:00Z")+ def test_breakdown_with_special_character_property_name(self):+ self.create_issue(self.issue_id, self.fingerprint)+ self.create_exception_event("user_1", {"completion%": "50%"})+ flush_persons_and_events()++ runner = ErrorTrackingBreakdownsQueryRunner(+ team=self.team,+ query=ErrorTrackingBreakdownsQuery(+ kind="ErrorTrackingBreakdownsQuery",+ issueId=self.issue_id,+ breakdownProperties=["completion%"],+ dateRange=DateRange(date_from="-7d"),+ maxValuesPerProperty=3,+ ),+ )++ response = runner.calculate()++ property_data = response.results["completion%"]+ assert property_data.total_count == 1+ assert property_data.values == [BreakdownValue(value="50%", count=1)]+def test_rejects_malformed_issue_id(self):with self.assertRaises(ValidationError):ErrorTrackingBreakdownsQueryRunner(diff --git a/products/error_tracking/frontend/ErrorTracking.stories.tsx b/products/error_tracking/frontend/ErrorTracking.stories.tsxindex fc35fc5186b4..0d7a834e5ab8 100644--- a/products/error_tracking/frontend/ErrorTracking.stories.tsx+++ b/products/error_tracking/frontend/ErrorTracking.stories.tsx@@ -4,6 +4,7 @@ import { Meta, StoryObj } from '@storybook/react'import { useActions } from 'kea'import { useLayoutEffect, useState } from 'react'+import type { ErrorEventType } from 'lib/components/Errors/types'import { App } from 'scenes/App'import { teamLogic } from 'scenes/teamLogic'import { urls } from 'scenes/urls'@@ -14,6 +15,10 @@ import { ErrorTrackingQueryResponse, NodeKind } from '~/queries/schema/schema-geimport { errorTrackingQueryResponse, errorTrackingTypeIssue } from './__mocks__/error_tracking_query'import { TEST_EVENTS } from './__mocks__/events'import { results as stackFrameResults } from './__mocks__/stack_frames/batch_get'+import { BreakdownPreset } from './components/Breakdowns/consts'+import { miniBreakdownsLogic } from './components/Breakdowns/miniBreakdownsLogic'+import { issueFilterPreviewLogic, IssueFilterPreview } from './components/IssueFilterPreview/issueFilterPreviewLogic'+import { errorTrackingIssueSceneLogic } from './scenes/ErrorTrackingIssueScene/errorTrackingIssueSceneLogic'const ISSUE_ID = 'issue-id'const FINGERPRINT = String(TEST_EVENTS.javascript_resolved.properties.$exception_fingerprint)@@ -35,6 +40,7 @@ const STORY_EVENT_UUIDS = STORY_TIMESTAMPS.map((_, index) => `story-event-${indeconst STORY_EVENT_PROPERTIES = JSON.stringify({...TEST_EVENTS.javascript_resolved.properties,$exception_fingerprint: FINGERPRINT,+ release_channel: 'stable',})const STORY_EXCEPTION_LIST = TEST_EVENTS.javascript_resolved.properties.$exception_listconst STORY_TIMELINE_RESPONSE = {@@ -70,6 +76,126 @@ const STORY_EVENTS_RESPONSE = {STORY_PERSON,]),}+const STORY_EMPTY_EVENTS_RESPONSE = {+ columns: ['*', 'timestamp', 'person'],+ hasMore: false,+ results: [],+}+const STORY_BREAKDOWNS_RESPONSE = {+ results: {+ $browser: {+ values: [+ { value: 'Chrome', count: 24 },+ { value: 'Firefox', count: 9 },+ { value: 'Safari', count: 5 },+ ],+ total_count: 38,+ },+ $device_type: {+ values: [+ { value: 'Desktop', count: 30 },+ { value: 'Mobile', count: 8 },+ ],+ total_count: 38,+ },+ $os: {+ values: [+ { value: 'Mac OS X', count: 20 },+ { value: 'Windows', count: 12 },+ { value: 'Linux', count: 6 },+ ],+ total_count: 38,+ },+ $pathname: {+ values: [+ { value: '/billing', count: 19 },+ { value: '/settings', count: 11 },+ { value: '/dashboard', count: 8 },+ ],+ total_count: 38,+ },+ $user_id: {+ values: [+ { value: 'user-101', count: 16 },+ { value: 'user-205', count: 12 },+ { value: 'user-309', count: 10 },+ ],+ total_count: 38,+ },+ $ip: {+ values: [+ { value: '192.0.2.10', count: 18 },+ { value: '198.51.100.20', count: 12 },+ { value: '203.0.113.30', count: 8 },+ ],+ total_count: 38,+ },+ $current_url: {+ values: [+ { value: 'https://example.com/billing', count: 21 },+ { value: 'https://example.com/settings', count: 11 },+ { value: 'https://example.com/dashboard', count: 6 },+ ],+ total_count: 38,+ },+ release_channel: {+ values: [+ { value: 'stable', count: 25 },+ { value: 'beta', count: 9 },+ { value: 'canary', count: 4 },+ ],+ total_count: 38,+ },+ },+}+const STORY_MANY_CUSTOM_PROPERTIES = Object.fromEntries(+ Array.from({ length: 18 }, (_, index) => [`custom_property_${index + 1}`, `value_${index + 1}`])+)+const STORY_MANY_EVENT_PROPERTIES = JSON.stringify({+ ...JSON.parse(STORY_EVENT_PROPERTIES),+ ...STORY_MANY_CUSTOM_PROPERTIES,+})+const STORY_MANY_BREAKDOWNS_RESPONSE = {+ results: {+ ...STORY_BREAKDOWNS_RESPONSE.results,+ ...Object.fromEntries(+ Object.keys(STORY_MANY_CUSTOM_PROPERTIES).map((property, index) => [+ property,+ {+ values: [+ { value: `value_${index + 1}`, count: 20 },+ { value: 'other', count: 18 },+ ],+ total_count: 38,+ },+ ])+ ),+ },+}+Object.assign(STORY_BREAKDOWNS_RESPONSE.results, STORY_MANY_BREAKDOWNS_RESPONSE.results)+const STORY_PROPERTY_DEFINITIONS = {+ count: 2,+ next: null,+ previous: null,+ results: [+ {+ id: 'current-url',+ name: '$current_url',+ description: 'The current URL of the page',+ property_type: 'String',+ type: 1,+ verified: true,+ },+ {+ id: 'plan',+ name: 'plan',+ description: 'The account plan',+ property_type: 'String',+ type: 1,+ verified: false,+ },+ ],+}const STORY_POSITION_EVENT = {uuid: STORY_EVENT_UUIDS[0],distinct_id: STORY_PERSON.distinct_id,@@ -109,7 +235,6 @@ const STORY_SUMMARY_RESPONSE: ErrorTrackingQueryResponse = {},],}-const meta: Meta = {component: App,title: 'Scenes-App/ErrorTracking',@@ -151,6 +276,7 @@ const meta: Meta = {'/api/environments/:team_id/error_tracking/spike_events': [200, { results: [] }],// Empty keeps this story's snapshot unchanged; the populated section has its own story.'/api/projects/:team_id/signals/reports/': [200, { next: null, results: [] }],+ '/api/projects/:team_id/property_definitions/': [200, STORY_PROPERTY_DEFINITIONS],'/api/environments/:team_id/session_recordings/:id/capture_diagnostics/': [200,{ properties: { $has_recording: true, $recording_status: 'active' } },@@ -159,6 +285,9 @@ const meta: Meta = {post: {'/api/environments/:team_id/query/:kind/': async ({ request }) => {const body = (await request.json()) as { query?: { kind?: string; select?: string[] } }+ if (body.query?.kind === NodeKind.ErrorTrackingBreakdownsQuery) {+ return [200, STORY_BREAKDOWNS_RESPONSE]+ }if (body.query?.kind === NodeKind.EventsQuery) {return body.query.select?.includes('properties.$exception_list')? [200, STORY_TIMELINE_RESPONSE]@@ -218,6 +347,57 @@ export const ListPageWithSourceMapsBanner: Story = {}// Autocapture must be on for the issue list to render instead of the full setup prompt,// and it comes from the bootstrap app context, so an msw override isn't enough+function IssueScenePreviewStory({+ activePreview,+ selectedEventProperties,+ openBreakdown,+ propertyFilter,+}: {+ activePreview: IssueFilterPreview+ selectedEventProperties?: string+ openBreakdown?: BreakdownPreset+ propertyFilter?: { key: string; value: string }+}): JSX.Element {+ const { applyPropertyFilter, setActivePreview } = useActions(issueFilterPreviewLogic)+ const { selectEvent } = useActions(errorTrackingIssueSceneLogic({ id: ISSUE_ID }))+ const { openBreakdownDetails } = useActions(miniBreakdownsLogic({ issueId: ISSUE_ID }))++ useLayoutEffect(() => {+ setActivePreview(activePreview)+ if (selectedEventProperties) {+ selectEvent({+ event: '$exception',+ uuid: STORY_EVENT_UUIDS[0],+ timestamp: STORY_TIMESTAMPS[0],+ distinct_id: STORY_PERSON.distinct_id,+ properties: JSON.parse(selectedEventProperties),+ person: {+ id: STORY_PERSON.id,+ distinct_ids: [STORY_PERSON.distinct_id],+ properties: STORY_PERSON.properties,+ },+ } as ErrorEventType)+ }+ if (openBreakdown) {+ openBreakdownDetails(openBreakdown)+ }+ if (propertyFilter) {+ applyPropertyFilter(propertyFilter.key, propertyFilter.value)+ }+ }, [+ activePreview,+ applyPropertyFilter,+ openBreakdown,+ openBreakdownDetails,+ propertyFilter,+ selectEvent,+ selectedEventProperties,+ setActivePreview,+ ])++ return <App />+}+function IngestionWarningStory(): JSX.Element | null {const { loadCurrentTeamSuccess } = useActions(teamLogic)const [ready, setReady] = useState(false)@@ -247,6 +427,122 @@ export const GroupPage: Story = {parameters: { pageUrl: urls.errorTrackingIssue(ISSUE_ID) },}+export const GroupPageContentSizedBreakdownPanel: Story = {+ name: 'Issue scene with content-sized breakdown panel',+ parameters: { pageUrl: urls.errorTrackingIssue(ISSUE_ID) },+ render: () => <IssueScenePreviewStory activePreview="properties" />,+}++export const GroupPageCappedBreakdownPanel: Story = {+ name: 'Issue scene with capped breakdown panel',+ parameters: { pageUrl: urls.errorTrackingIssue(ISSUE_ID) },+ render: () => (+ <IssueScenePreviewStory activePreview="properties" selectedEventProperties={STORY_MANY_EVENT_PROPERTIES} />+ ),+}++export const GroupPageBreakdownLoading: Story = {+ name: 'Issue scene with loading breakdown panel',+ parameters: {+ pageUrl: urls.errorTrackingIssue(ISSUE_ID),+ testOptions: { waitForLoadersToDisappear: false },+ },+ decorators: [+ mswDecorator({+ post: {+ '/api/environments/:team_id/query/:kind/': async ({ request }) => {+ const body = (await request.json()) as { query?: { kind?: string; select?: string[] } }+ if (body.query?.kind === NodeKind.ErrorTrackingBreakdownsQuery) {+ return new Promise<never>(() => {})+ }+ if (body.query?.kind === NodeKind.EventsQuery) {+ return body.query.select?.includes('properties.$exception_list')+ ? [200, STORY_TIMELINE_RESPONSE]+ : [200, STORY_EVENTS_RESPONSE]+ }+ return body.query?.kind === NodeKind.HogQLQuery+ ? [200, { results: [] }]+ : [200, STORY_SUMMARY_RESPONSE]+ },+ },+ }),+ ],+ render: () => <IssueScenePreviewStory activePreview="properties" />,+}++export const GroupPageBreakdownModal: Story = {+ name: 'Issue scene with breakdown modal',+ parameters: { pageUrl: urls.errorTrackingIssue(ISSUE_ID) },+ render: () => (+ <IssueScenePreviewStory activePreview="properties" openBreakdown={{ property: '$browser', title: 'Browser' }} />+ ),+}++export const GroupPageBreakdownModalLoading: Story = {+ name: 'Issue scene with loading breakdown modal',+ parameters: {+ pageUrl: urls.errorTrackingIssue(ISSUE_ID),+ testOptions: { waitForLoadersToDisappear: false },+ },+ decorators: [+ mswDecorator({+ post: {+ '/api/environments/:team_id/query/:kind/': async ({ request }) => {+ const body = (await request.json()) as {+ query?: { kind?: string; select?: string[]; maxValuesPerProperty?: number }+ }+ if (+ body.query?.kind === NodeKind.ErrorTrackingBreakdownsQuery &&+ body.query.maxValuesPerProperty === 100+ ) {+ return new Promise<never>(() => {})+ }+ if (body.query?.kind === NodeKind.ErrorTrackingBreakdownsQuery) {+ return [200, STORY_BREAKDOWNS_RESPONSE]+ }+ if (body.query?.kind === NodeKind.EventsQuery) {+ return body.query.select?.includes('properties.$exception_list')+ ? [200, STORY_TIMELINE_RESPONSE]+ : [200, STORY_EVENTS_RESPONSE]+ }+ return body.query?.kind === NodeKind.HogQLQuery+ ? [200, { results: [] }]+ : [200, STORY_SUMMARY_RESPONSE]+ },+ },+ }),+ ],+ render: () => (+ <IssueScenePreviewStory activePreview="properties" openBreakdown={{ property: '$browser', title: 'Browser' }} />+ ),+}++export const GroupPageEmptyWithFilter: Story = {+ name: 'Issue scene with no matching exceptions',+ parameters: { pageUrl: urls.errorTrackingIssue(ISSUE_ID) },+ decorators: [+ mswDecorator({+ post: {+ '/api/environments/:team_id/query/:kind/': async ({ request }) => {+ const body = (await request.json()) as { query?: { kind?: string; select?: string[] } }+ if (body.query?.kind === NodeKind.ErrorTrackingBreakdownsQuery) {+ return [200, STORY_BREAKDOWNS_RESPONSE]+ }+ if (body.query?.kind === NodeKind.EventsQuery) {+ return body.query.select?.includes('properties.$exception_list')+ ? [200, STORY_TIMELINE_RESPONSE]+ : [200, STORY_EMPTY_EVENTS_RESPONSE]+ }+ return body.query?.kind === NodeKind.HogQLQuery+ ? [200, { results: [] }]+ : [200, STORY_SUMMARY_RESPONSE]+ },+ },+ }),+ ],+ render: () => <IssueScenePreviewStory activePreview="time" propertyFilter={{ key: '$browser', value: 'Chrome' }} />,+}+export const GroupPageLoading: Story = {name: 'Issue scene loading',parameters: {diff --git a/products/error_tracking/frontend/components/Breakdowns/BreakdownDetailsDialog.tsx b/products/error_tracking/frontend/components/Breakdowns/BreakdownDetailsDialog.tsxnew file mode 100644index 000000000000..87fd76508d4b--- /dev/null+++ b/products/error_tracking/frontend/components/Breakdowns/BreakdownDetailsDialog.tsx@@ -0,0 +1,173 @@+import { useActions, useValues } from 'kea'+import { useMemo } from 'react'++import { PieChart } from '@posthog/quill-charts'+import type { PieChartConfig, Series } from '@posthog/quill-charts'++import { useChartTheme } from 'lib/charts/hooks'+import { Button, Dialog, DialogBody, DialogContent, DialogHeader, DialogTitle, Skeleton, Text } from 'lib/ui/quill'+import { humanFriendlyLargeNumber } from 'lib/utils/numbers'+import { BREAKDOWN_NULL_DISPLAY, BREAKDOWN_OTHER_DISPLAY, isNullBreakdown } from 'scenes/insights/utils'++import { PropertyOperator } from '~/types'++import { issueFilterPreviewLogic } from '../IssueFilterPreview/issueFilterPreviewLogic'+import {+ BreakdownSinglePropertyStat,+ getBreakdownForPropertyFromResponse,+ miniBreakdownsLogic,+} from './miniBreakdownsLogic'++const PIE_CONFIG: PieChartConfig = {+ innerRadiusRatio: 0.55,+ showLabelOnSlice: false,+ showValueOnSlice: false,+}++export function BreakdownDetailsDialog(): JSX.Element {+ const theme = useChartTheme()+ const { selectedBreakdownProperty, breakdownDetails, breakdownDetailsLoading, breakdownDetailsError } =+ useValues(miniBreakdownsLogic)+ const { closeBreakdownDetails, loadBreakdownDetails } = useActions(miniBreakdownsLogic)+ const { applyPropertyFilter } = useActions(issueFilterPreviewLogic)+ const { properties, totalCount } = getBreakdownForPropertyFromResponse(+ breakdownDetails,+ selectedBreakdownProperty?.property ?? ''+ )+ const selectBreakdownValue = (item: BreakdownSinglePropertyStat): void => {+ // "Other" is a synthetic bucket for values beyond the query limit, not a real property+ // value, so filtering exactly on its label would match no exceptions.+ if (!selectedBreakdownProperty || item.label === BREAKDOWN_OTHER_DISPLAY) {+ return+ }+ applyPropertyFilter(+ selectedBreakdownProperty.property,+ isNullBreakdown(item.label) ? null : item.label,+ isNullBreakdown(item.label) ? PropertyOperator.IsNotSet : PropertyOperator.Exact+ )+ closeBreakdownDetails()+ }+ const series = useMemo<Series<BreakdownSinglePropertyStat>[]>(+ () =>+ properties.map((item, index) => ({+ key: `${item.label}:${index}`,+ label: isNullBreakdown(item.label) ? BREAKDOWN_NULL_DISPLAY : item.label,+ data: [item.count],+ meta: item,+ })),+ [properties]+ )++ return (+ <Dialog open={selectedBreakdownProperty !== null} onOpenChange={(open) => !open && closeBreakdownDetails()}>+ <DialogContent size="wide" className="max-w-3xl">+ <DialogHeader>+ <DialogTitle>Property breakdown</DialogTitle>+ </DialogHeader>+ <DialogBody>+ {breakdownDetailsError ? (+ <div className="flex min-h-64 flex-col items-center justify-center gap-2">+ <Text variant="destructive">Couldn’t load the breakdown values.</Text>+ <Button+ variant="outline"+ loading={breakdownDetailsLoading}+ onClick={() => {+ if (selectedBreakdownProperty) {+ loadBreakdownDetails({ property: selectedBreakdownProperty.property })+ }+ }}+ >+ Try again+ </Button>+ </div>+ ) : breakdownDetailsLoading ? (+ <div className="grid min-h-80 grid-cols-1 gap-4 md:grid-cols-[20rem_minmax(0,1fr)]">+ <div className="mx-auto flex aspect-square w-full max-w-80 items-center justify-center">+ <Skeleton className="aspect-square w-4/5 rounded-full bg-border" />+ </div>+ <div className="flex min-w-0 flex-col gap-2 border-t border-primary pt-4 md:border-l md:border-t-0 md:py-1 md:pl-4">+ <Skeleton className="h-5 w-32 bg-border" />+ {Array.from({ length: 7 }, (_, index) => (+ <Skeleton key={index} className="h-8 w-full bg-border" />+ ))}+ </div>+ </div>+ ) : properties.length === 0 ? (+ <div className="flex min-h-64 items-center justify-center">+ <Text variant="muted">No values found.</Text>+ </div>+ ) : (+ <div className="grid min-h-80 grid-cols-1 gap-4 md:grid-cols-[20rem_minmax(0,1fr)]">+ <div className="mx-auto flex aspect-square w-full max-w-80 min-w-0 flex-col">+ <PieChart+ series={series}+ theme={theme}+ config={PIE_CONFIG}+ onSliceClick={({ series: clickedSeries }) => {+ if (clickedSeries.meta) {+ selectBreakdownValue(clickedSeries.meta)+ }+ }}+ centerLabel={+ <div className="text-center">+ <div className="text-xl font-semibold tabular-nums">+ {humanFriendlyLargeNumber(totalCount)}+ </div>+ <Text size="xs" variant="muted">+ occurrences+ </Text>+ </div>+ }+ />+ </div>+ <div className="min-w-0 border-t border-primary pt-4 md:border-l md:border-t-0 md:pl-4 md:pt-0">+ <Text size="sm" weight="semibold" className="pb-2">+ {selectedBreakdownProperty?.title ?? 'Property'}+ </Text>+ <div className="max-h-72 overflow-y-auto">+ {properties.map((item, index) => (+ <button+ key={`${item.label}:${index}`}+ type="button"+ disabled={item.label === BREAKDOWN_OTHER_DISPLAY}+ className={`flex h-8 w-full items-center justify-between gap-3 border-b border-primary px-1 text-left ${+ item.label === BREAKDOWN_OTHER_DISPLAY+ ? 'cursor-default'+ : 'hover:bg-fill-button-tertiary-hover focus-visible:ring-2 focus-visible:ring-primary'+ }`}+ onClick={() => selectBreakdownValue(item)}+ >+ <Text size="xs" className="min-w-0 truncate" title={item.label}>+ {isNullBreakdown(item.label) ? BREAKDOWN_NULL_DISPLAY : item.label}+ </Text>+ <div className="shrink-0 text-right">+ <Text+ size="xs"+ weight="medium"+ render={<span />}+ className="tabular-nums"+ >+ {humanFriendlyLargeNumber(item.count)}+ </Text>+ <Text+ size="xxs"+ variant="muted"+ render={<span />}+ className="ms-1 tabular-nums"+ >+ {totalCount > 0+ ? `${((item.count / totalCount) * 100).toFixed(1)}%`+ : '0%'}+ </Text>+ </div>+ </button>+ ))}+ </div>+ </div>+ </div>+ )}+ </DialogBody>+ </DialogContent>+ </Dialog>+ )+}diff --git a/products/error_tracking/frontend/components/Breakdowns/BreakdownsChart.tsx b/products/error_tracking/frontend/components/Breakdowns/BreakdownsChart.tsxdeleted file mode 100644index 93029eddf074..000000000000--- a/products/error_tracking/frontend/components/Breakdowns/BreakdownsChart.tsx+++ /dev/null@@ -1,39 +0,0 @@-import { useValues } from 'kea'-import { useMemo } from 'react'--import { Query } from '~/queries/Query/Query'-import { FilterLogicalOperator } from '~/types'--import { errorTrackingIssueBreakdownQuery } from '../../queries'-import { errorTrackingIssueSceneLogic } from '../../scenes/ErrorTrackingIssueScene/errorTrackingIssueSceneLogic'-import { breakdownFiltersLogic } from './breakdownFiltersLogic'--export function BreakdownsChart(): JSX.Element {- const { issue } = useValues(errorTrackingIssueSceneLogic)- const { breakdownProperty, dateRange, filterTestAccounts } = useValues(breakdownFiltersLogic)-- const query = useMemo(- () =>- errorTrackingIssueBreakdownQuery({- breakdownProperty,- dateRange,- filterTestAccounts,- filterGroup: {- type: FilterLogicalOperator.And,- values: [{ type: FilterLogicalOperator.And, values: [] }],- },- issueId: issue?.id ?? '',- }),- [breakdownProperty, dateRange, filterTestAccounts, issue?.id]- )-- if (!issue?.id) {- return <></>- }-- return (- <div className="ErrorTracking__breakdowns p-2 flex-1 min-h-0">- <Query query={query} context={{ ignoreActionsInSeriesLabels: true }} />- </div>- )-}diff --git a/products/error_tracking/frontend/components/Breakdowns/BreakdownsSearchBar.tsx b/products/error_tracking/frontend/components/Breakdowns/BreakdownsSearchBar.tsxdeleted file mode 100644index cc05e929b83c..000000000000--- a/products/error_tracking/frontend/components/Breakdowns/BreakdownsSearchBar.tsx+++ /dev/null@@ -1,82 +0,0 @@-import { useActions, useValues } from 'kea'-import posthog from 'posthog-js'-import { useMemo } from 'react'--import { PropertyKeyInfo } from 'lib/components/PropertyKeyInfo'-import { TaxonomicFilterHeadless } from 'lib/components/TaxonomicFilter/headless'-import { MenuFilterEntry } from 'lib/components/TaxonomicFilter/menu'-import { TaxonomicFilterMenu } from 'lib/components/TaxonomicFilter/menu/TaxonomicFilterMenu'-import { TaxonomicFilterGroupType } from 'lib/components/TaxonomicFilter/types'-import { Button, SelectTriggerIcon } from 'lib/ui/quill'--import { DateRangeButton } from '../DateRangeButton'-import { InternalAccountsToggle } from '../InternalAccountsToggle'-import { breakdownFiltersLogic } from './breakdownFiltersLogic'-import { BreakdownsEvents, TAXONOMIC_GROUP_TYPES } from './consts'--export function BreakdownsSearchBar(): JSX.Element {- const { dateRange, filterTestAccounts, breakdownProperty } = useValues(breakdownFiltersLogic)- const { setDateRange, setFilterTestAccounts, setBreakdownProperty } = useActions(breakdownFiltersLogic)-- /*- * Synthetic entry for the current property. The menu reads `group.type` to route the- * initial open — with it set the picker lands straight on the searchable property list- * with this property highlighted, rather than the category menu. A full- * `TaxonomicFilterGroup` isn't needed; the orchestrator resolves the real one on commit.- */- const selected = useMemo<MenuFilterEntry>(- () =>- ({- item: { id: breakdownProperty, name: breakdownProperty },- group: {- type: TaxonomicFilterGroupType.EventProperties,- getName: (item: any) => item?.name,- getValue: (item: any) => item?.name ?? item?.id,- },- name: breakdownProperty,- }) as unknown as MenuFilterEntry,- [breakdownProperty]- )-- return (- <div className="flex items-center flex-wrap px-2 py-2 gap-1">- <DateRangeButton dateRange={dateRange} onChange={setDateRange} />- <TaxonomicFilterHeadless.Root- className="contents"- bindRootProps={false}- groupType={TaxonomicFilterGroupType.EventProperties}- taxonomicGroupTypes={TAXONOMIC_GROUP_TYPES}- value={breakdownProperty}- onChange={(_, value) => {- if (value) {- setBreakdownProperty(String(value))- posthog.capture(BreakdownsEvents.PropertySelected, {- property: String(value),- })- }- }}- >- <TaxonomicFilterMenu- selected={selected}- trigger={({ open }) => (- <Button variant="outline" size="default" aria-expanded={open} data-attr="breakdown-property">- <PropertyKeyInfo- value={breakdownProperty}- disablePopover- type={TaxonomicFilterGroupType.EventProperties}- />- <SelectTriggerIcon />- </Button>- )}- />- </TaxonomicFilterHeadless.Root>- <div className="ml-auto shrink-0">- <InternalAccountsToggle- filterTestAccounts={filterTestAccounts}- onChange={setFilterTestAccounts}- id="error-tracking-breakdowns-test-account-filter"- />- </div>- </div>- )-}diff --git a/products/error_tracking/frontend/components/Breakdowns/BreakdownsStackedBar.tsx b/products/error_tracking/frontend/components/Breakdowns/BreakdownsStackedBar.tsxindex 77413b36c764..025776bf8f3a 100644--- a/products/error_tracking/frontend/components/Breakdowns/BreakdownsStackedBar.tsx+++ b/products/error_tracking/frontend/components/Breakdowns/BreakdownsStackedBar.tsx@@ -1,6 +1,11 @@-import { getSeriesColor } from 'lib/colors'-import { PropertyIcon } from 'lib/components/PropertyIcon/PropertyIcon'-import { Tooltip } from 'lib/lemon-ui/Tooltip'+import { useMemo } from 'react'++import { BarChart } from '@posthog/quill-charts'+import type { BarChartConfig, PointClickData, Series } from '@posthog/quill-charts'++import { useChartConfig, useChartTheme } from 'lib/charts/hooks'+import { humanFriendlyLargeNumber } from 'lib/utils/numbers'+import { BREAKDOWN_OTHER_DISPLAY, isNullBreakdown, BREAKDOWN_NULL_DISPLAY } from 'scenes/insights/utils'import { BreakdownSinglePropertyStat } from './miniBreakdownsLogic'@@ -8,46 +13,80 @@ interface BreakdownsStackedBarProps {properties: BreakdownSinglePropertyStat[]totalCount: numberpropertyName: string+ propertyLabel?: string+ onValueClick?: (value: BreakdownSinglePropertyStat) => void}-export function BreakdownsStackedBar({ properties, totalCount, propertyName }: BreakdownsStackedBarProps): JSX.Element {- return (- <div className="flex w-full h-4 rounded overflow-hidden bg-fill-secondary">- {properties.map((item, index) => {- const percentage = (item.count / totalCount) * 100+export function BreakdownsStackedBar({+ properties,+ totalCount,+ propertyName,+ propertyLabel = propertyName,+ onValueClick,+}: BreakdownsStackedBarProps): JSX.Element {+ const theme = useChartTheme()+ const series = useMemo<Series<BreakdownSinglePropertyStat>[]>(+ () =>+ properties.map((item, index) => ({+ key: `${propertyName}:${index}`,+ label: isNullBreakdown(item.label) ? BREAKDOWN_NULL_DISPLAY : item.label,+ data: [item.count],+ meta: item,+ })),+ [properties, propertyName]+ )+ const labels = useMemo(() => [propertyLabel], [propertyLabel])+ const config = useChartConfig<BarChartConfig>(+ () => ({+ axisOrientation: 'horizontal',+ barLayout: 'percent',+ hideXAxis: true,+ showGrid: false,+ showAxisLines: false,+ showTickMarks: false,+ showCrosshair: false,+ maxCategoryLabelWidth: 0,+ xTickFormatter: () => '',+ margins: { top: 0, right: 0, bottom: 0, left: 0 },+ barCornerRadius: 2,+ bars: {+ bandPadding: 0,+ fitToHeight: true,+ minBandSize: 8,+ roundStackEnds: true,+ shadow: false,+ },+ tooltip: {+ placement: 'cursor',+ pinnable: false,+ sortedByValue: true,+ valueFormatter: (_value, entry) => {+ const count = (entry.series.meta as BreakdownSinglePropertyStat | undefined)?.count ?? 0+ const percentage = totalCount > 0 ? (count / totalCount) * 100 : 0+ return `${humanFriendlyLargeNumber(count)} occurrences (${percentage.toFixed(1)}%)`+ },+ },+ }),+ [totalCount]+ )++ const handlePointClick = ({ series: clickedSeries }: PointClickData<BreakdownSinglePropertyStat>): void => {+ const value = clickedSeries.meta+ if (value && value.label !== BREAKDOWN_OTHER_DISPLAY) {+ onValueClick?.(value)+ }+ }- return (- <Tooltip- key={index}- delayMs={0}- title={- <>- <div className="flex items-center gap-1.5 font-semibold">- <PropertyIcon property={propertyName} value={item.label} />- <span>{item.label}</span>- </div>- <div className="opacity-70">{percentage.toFixed(1)}%</div>- </>- }- >- <div- className="h-full hover:opacity-80 flex items-center justify-center"- style={{- width: `${percentage}%`,- backgroundColor: getSeriesColor(index),- }}- >- {percentage > 8 && (- <PropertyIcon- property={propertyName}- value={item.label}- className="text-white text-xs opacity-90"- />- )}- </div>- </Tooltip>- )- })}+ return (+ <div className="flex h-3 w-full overflow-hidden rounded-sm">+ <BarChart+ series={series}+ labels={labels}+ config={config}+ theme={theme}+ className="h-full"+ onPointClick={onValueClick ? handlePointClick : undefined}+ /></div>)}diff --git a/products/error_tracking/frontend/components/Breakdowns/BreakdownsTileButton.tsx b/products/error_tracking/frontend/components/Breakdowns/BreakdownsTileButton.tsxindex 958f0d559210..6e3ee5024725 100644--- a/products/error_tracking/frontend/components/Breakdowns/BreakdownsTileButton.tsx+++ b/products/error_tracking/frontend/components/Breakdowns/BreakdownsTileButton.tsx@@ -1,14 +1,14 @@import { useActions, useValues } from 'kea'import posthog from 'posthog-js'-import { Tooltip } from '@posthog/lemon-ui'+import { Tooltip as LemonTooltip } from '@posthog/lemon-ui'-import { Skeleton } from 'lib/ui/quill'-import { cn } from 'lib/utils/css-classes'-import { BREAKDOWN_NULL_STRING_LABEL } from 'scenes/insights/utils'+import { Button, Skeleton } from 'lib/ui/quill'+import { BREAKDOWN_NULL_STRING_LABEL, isNullBreakdown } from 'scenes/insights/utils'-import { errorTrackingIssueSceneConfigurationLogic } from '../../scenes/ErrorTrackingIssueScene/errorTrackingIssueSceneConfigurationLogic'-import { breakdownFiltersLogic } from './breakdownFiltersLogic'+import { PropertyOperator } from '~/types'++import { issueFilterPreviewLogic } from '../IssueFilterPreview/issueFilterPreviewLogic'import { BreakdownsStackedBar } from './BreakdownsStackedBar'import { BreakdownPreset, BreakdownsEvents } from './consts'import { miniBreakdownsLogic } from './miniBreakdownsLogic'@@ -17,68 +17,70 @@ interface BreakdownsTileButtonProps {item: BreakdownPreset}-export function BreakdownsTileButton({ item }: BreakdownsTileButtonProps): JSX.Element {- const { breakdownProperty } = useValues(breakdownFiltersLogic)- const { setBreakdownProperty } = useActions(breakdownFiltersLogic)- const { category } = useValues(errorTrackingIssueSceneConfigurationLogic)- const { setCategory } = useActions(errorTrackingIssueSceneConfigurationLogic)-- const isSelected = category === 'breakdowns' && breakdownProperty === item.property-- return (- <button- onClick={() => {- setBreakdownProperty(item.property)- setCategory('breakdowns')- posthog.capture(BreakdownsEvents.MiniBreakdownsPropertySelected, {- property: item.property,- })- }}- className={cn(- 'w-full px-2.5 py-2 text-left border-l-[3px] cursor-pointer',- isSelected ? 'border-l-brand-yellow' : 'border-l-transparent'- )}- >- <BreakdownPreview title={item.title} property={item.property} />- </button>- )-}--function BreakdownPreview({ title, property }: { title: string; property: string }): JSX.Element {+export function BreakdownsTileButton({ item: { title, property } }: BreakdownsTileButtonProps): JSX.Element {const { getBreakdownForProperty, responseLoading, responseError } = useValues(miniBreakdownsLogic)- const { loadResponse } = useActions(miniBreakdownsLogic)+ const { loadResponse, openBreakdownDetails } = useActions(miniBreakdownsLogic)+ const { applyPropertyFilter } = useActions(issueFilterPreviewLogic)const { properties, totalCount } = getBreakdownForProperty(property)const hasOnlyNullBreakdown = properties.length === 1 && properties[0].label === BREAKDOWN_NULL_STRING_LABEL+ const hasNoData = !responseLoading && !responseError && (properties.length === 0 || hasOnlyNullBreakdown)return (- <div className="flex items-center gap-2">- <div className="font-semibold text-xs w-[30%]">{title}</div>- <div className="w-[70%]">+ <>+ <LemonTooltip title={hasNoData ? 'No data available for this property' : undefined}>+ <span className="min-w-0">+ <Button+ variant="default"+ size="sm"+ disabled={hasNoData}+ className="h-[22px] w-full min-w-0 justify-end rounded-none border-r border-border ps-2.5 pe-2 text-right text-xs font-semibold"+ onClick={() => {+ openBreakdownDetails({ property, title })+ posthog.capture(BreakdownsEvents.MiniBreakdownsPropertySelected, { property })+ }}+ >+ <span className="truncate">{title}</span>+ </Button>+ </span>+ </LemonTooltip>+ <div className="flex h-[22px] min-w-0 items-center ps-2 pe-4">{responseError ? (- <Tooltip title={responseError}>+ <LemonTooltip title={responseError}><button- className="text-danger text-xs h-4 flex items-center justify-center w-full underline decoration-dotted"- onClick={(e) => {- e.stopPropagation()+ className="text-danger flex h-6 w-full items-center justify-center text-xs underline decoration-dotted"+ onClick={(event) => {+ event.stopPropagation()loadResponse()}}>Failed to load, click to retry</button>- </Tooltip>+ </LemonTooltip>) : responseLoading ? (- <div className="h-4 flex items-center justify-center">- <Skeleton className="h-4 w-full">+ <div className="flex h-3 w-full items-center justify-center">+ <Skeleton className="h-3 w-full rounded-sm bg-border"><span>Loading…</span></Skeleton></div>- ) : properties.length === 0 || hasOnlyNullBreakdown ? (- <div className="text-muted text-xs h-4 flex items-center justify-center">No data</div>+ ) : hasNoData ? (+ <div className="text-muted flex h-6 items-center justify-center text-xs">No data</div>) : (- <BreakdownsStackedBar properties={properties} totalCount={totalCount} propertyName={property} />+ <BreakdownsStackedBar+ properties={properties}+ totalCount={totalCount}+ propertyName={property}+ propertyLabel={title}+ onValueClick={(item) => {+ applyPropertyFilter(+ property,+ isNullBreakdown(item.label) ? null : item.label,+ isNullBreakdown(item.label) ? PropertyOperator.IsNotSet : PropertyOperator.Exact+ )+ }}+ />)}</div>- </div>+ </>)}diff --git a/products/error_tracking/frontend/components/Breakdowns/MiniBreakdowns.tsx b/products/error_tracking/frontend/components/Breakdowns/MiniBreakdowns.tsxindex 77245e06bd6e..f5efad148141 100644--- a/products/error_tracking/frontend/components/Breakdowns/MiniBreakdowns.tsx+++ b/products/error_tracking/frontend/components/Breakdowns/MiniBreakdowns.tsx@@ -1,14 +1,66 @@+import { useValues } from 'kea'++import { Text } from 'lib/ui/quill'++import { IssueFilterPreviewHeader } from '../IssueFilterPreview/IssueFilterPreviewHeader'+import { BreakdownDetailsDialog } from './BreakdownDetailsDialog'import { BreakdownsTileButton } from './BreakdownsTileButton'-import { BREAKDOWN_PRESETS } from './consts'+import { BREAKDOWN_PRESETS, BreakdownPreset } from './consts'+import { miniBreakdownsLogic } from './miniBreakdownsLogic'++const BUILT_IN_PROPERTY_NAMES = new Set(BREAKDOWN_PRESETS.map(({ property }) => property))export function MiniBreakdowns(): JSX.Element {+ const { breakdownProperties } = useValues(miniBreakdownsLogic)+ const builtInProperties = breakdownProperties.filter(({ property }) => BUILT_IN_PROPERTY_NAMES.has(property))+ const customProperties = breakdownProperties.filter(({ property }) => !BUILT_IN_PROPERTY_NAMES.has(property))+return (- <div className="px-2">- <div className="border rounded bg-surface-primary overflow-hidden divide-y">- {BREAKDOWN_PRESETS.map((item) => (- <BreakdownsTileButton key={item.property} item={item} />- ))}+ <div className="flex flex-col">+ <IssueFilterPreviewHeader preview="properties" title="Breakdown" />+ <div className="grid content-start grid-cols-[fit-content(12rem)_minmax(0,1fr)] gap-y-px pb-6 pt-1">+ <BreakdownPropertySection+ id="built-in-breakdown-properties"+ title="Built-in properties"+ properties={builtInProperties}+ />+ {customProperties.length > 0 && (+ <BreakdownPropertySection+ id="custom-breakdown-properties"+ title="Custom properties"+ properties={customProperties}+ />+ )}</div>+ <BreakdownDetailsDialog /></div>)}++function BreakdownPropertySection({+ id,+ title,+ properties,+}: {+ id: string+ title: string+ properties: BreakdownPreset[]+}): JSX.Element {+ return (+ <section aria-labelledby={id} className="contents">+ <Text+ id={id}+ size="xxs"+ variant="muted"+ weight="semibold"+ render={<h3 />}+ className="!mb-0 col-span-2 flex h-10 items-center justify-center px-2.5 text-center uppercase tracking-wide"+ >+ {title}+ </Text>+ {properties.map((item) => (+ <BreakdownsTileButton key={item.property} item={item} />+ ))}+ </section>+ )+}diff --git a/products/error_tracking/frontend/components/Breakdowns/breakdownFiltersLogic.ts b/products/error_tracking/frontend/components/Breakdowns/breakdownFiltersLogic.tsdeleted file mode 100644index ff86372b63d2..000000000000--- a/products/error_tracking/frontend/components/Breakdowns/breakdownFiltersLogic.ts+++ /dev/null@@ -1,111 +0,0 @@-import { deepEqual as equal } from 'fast-equals'-import { MakeLogicType, actions, kea, path, reducers } from 'kea'-import { actionToUrl, router, urlToAction } from 'kea-router'--import { Params } from 'scenes/sceneTypes'--import { DateRange } from '~/queries/schema/schema-general'--import { syncSearchParams, updateSearchParams } from '../../utils'-import { DEFAULT_DATE_RANGE, DEFAULT_TEST_ACCOUNT } from './consts'--// Generated by kea-typegen. Update if you're an agent, ignore if you're human.-export interface breakdownFiltersLogicValues {- breakdownProperty: string- dateRange: DateRange- filterTestAccounts: boolean-}--// Generated by kea-typegen. Update if you're an agent, ignore if you're human.-export interface breakdownFiltersLogicActions {- setBreakdownProperty: (breakdownProperty: string) => {- breakdownProperty: string- }- setDateRange: (dateRange: DateRange) => {- dateRange: DateRange- }- setFilterTestAccounts: (filterTestAccounts: boolean) => {- filterTestAccounts: boolean- }-}--export type breakdownFiltersLogicType = MakeLogicType<breakdownFiltersLogicValues, breakdownFiltersLogicActions>--export const breakdownFiltersLogic = kea<breakdownFiltersLogicType>([- path(['products', 'error_tracking', 'components', 'Breakdowns', 'breakdownFiltersLogic']),-- actions({- setDateRange: (dateRange: DateRange) => ({ dateRange }),- setFilterTestAccounts: (filterTestAccounts: boolean) => ({ filterTestAccounts }),- setBreakdownProperty: (breakdownProperty: string) => ({ breakdownProperty }),- }),- reducers({- dateRange: [- DEFAULT_DATE_RANGE as DateRange,- { persist: true },- {- setDateRange: (_, { dateRange }) => dateRange,- },- ],- filterTestAccounts: [- DEFAULT_TEST_ACCOUNT as boolean,- { persist: true },- {- setFilterTestAccounts: (_, { filterTestAccounts }) => filterTestAccounts,- },- ],- breakdownProperty: [- '$browser' as string,- { persist: true },- {- setBreakdownProperty: (_, { breakdownProperty }) => breakdownProperty,- },- ],- }),-- urlToAction(({ actions, values }) => {- const urlToAction = (_: any, params: Params): void => {- const dateRange = params.dateRange ?? DEFAULT_DATE_RANGE- if (!equal(dateRange, values.dateRange)) {- actions.setDateRange(dateRange)- }-- const filterTestAccounts = params.filterTestAccounts ?? DEFAULT_TEST_ACCOUNT- if (filterTestAccounts !== values.filterTestAccounts) {- actions.setFilterTestAccounts(filterTestAccounts)- }-- const breakdownProperty = params.breakdownProperty ?? '$browser'- if (breakdownProperty !== values.breakdownProperty) {- actions.setBreakdownProperty(breakdownProperty)- }- }- return {- '*': urlToAction,- }- }),-- actionToUrl(({ values }) => {- const buildURL = (): [- string,- Params,- Record<string, any>,- {- replace: boolean- },- ] => {- return syncSearchParams(router, (params: Params) => {- updateSearchParams(params, 'filterTestAccounts', values.filterTestAccounts, DEFAULT_TEST_ACCOUNT)- updateSearchParams(params, 'dateRange', values.dateRange, DEFAULT_DATE_RANGE)- updateSearchParams(params, 'breakdownProperty', values.breakdownProperty, '$browser')- return params- })- }-- return {- setDateRange: () => buildURL(),- setFilterTestAccounts: () => buildURL(),- setBreakdownProperty: () => buildURL(),- }- }),-])diff --git a/products/error_tracking/frontend/components/Breakdowns/consts.ts b/products/error_tracking/frontend/components/Breakdowns/consts.tsindex 8e1947875ad2..ce94ab4e8df1 100644--- a/products/error_tracking/frontend/components/Breakdowns/consts.ts+++ b/products/error_tracking/frontend/components/Breakdowns/consts.ts@@ -1,36 +1,24 @@-import { TaxonomicFilterGroupType } from 'lib/components/TaxonomicFilter/types'--import { DateRange } from '~/queries/schema/schema-general'-export interface BreakdownPreset {property: stringtitle: string}-export const ERROR_TRACKING_BREAKDOWNS_DATA_COLLECTION_NODE_ID = 'error-tracking-breakdowns'-export const LIMIT_ITEMS = 3+export const BREAKDOWN_DETAILS_LIMIT = 100++// Each property adds an arrayJoin fan-out, so cap event-derived properties to keep query cost bounded.+export const MAX_SELECTED_EVENT_BREAKDOWN_PROPERTIES = 10export const BREAKDOWN_PRESETS: BreakdownPreset[] = [{ property: '$browser', title: 'Browser' },- { property: '$device_type', title: 'Device Type' },- { property: '$os', title: 'Operating System' },+ { property: '$device_type', title: 'Device type' },+ { property: '$os', title: 'Operating system' },{ property: '$pathname', title: 'Path' },{ property: '$user_id', title: 'User ID' },- { property: '$ip', title: 'IP Address' },-]--export const DEFAULT_DATE_RANGE: DateRange = { date_from: '-7d', date_to: null }--export const DEFAULT_TEST_ACCOUNT = false--export const TAXONOMIC_GROUP_TYPES = [- TaxonomicFilterGroupType.EventProperties,- TaxonomicFilterGroupType.PersonProperties,+ { property: '$ip', title: 'IP address' },]export const BreakdownsEvents = {MiniBreakdownsLoaded: 'error tracking mini breakdowns loaded',MiniBreakdownsPropertySelected: 'error tracking mini breakdowns property selected',- PropertySelected: 'error tracking breakdowns property selected',}diff --git a/products/error_tracking/frontend/components/Breakdowns/miniBreakdownsLogic.test.ts b/products/error_tracking/frontend/components/Breakdowns/miniBreakdownsLogic.test.tsindex ff60a082b342..8ed0fe6a979a 100644--- a/products/error_tracking/frontend/components/Breakdowns/miniBreakdownsLogic.test.ts+++ b/products/error_tracking/frontend/components/Breakdowns/miniBreakdownsLogic.test.ts@@ -1,32 +1,165 @@+import { expectLogic } from 'kea-test-utils'++import api from 'lib/api'+import type { ErrorEventType } from 'lib/components/Errors/types'+import { useMocks } from '~/mocks/jest'+import type {+ ErrorTrackingBreakdownsQuery,+ ErrorTrackingBreakdownsQueryResponse,+} from '~/queries/schema/schema-general'import { initKeaTests } from '~/test/init'-import { miniBreakdownsLogic } from './miniBreakdownsLogic'+import { errorTrackingIssueSceneLogic } from '../../scenes/ErrorTrackingIssueScene/errorTrackingIssueSceneLogic'+import { ERROR_TRACKING_ISSUE_SCENE_LOGIC_KEY, issueFiltersLogic } from '../IssueFilters/issueFiltersLogic'+import { BREAKDOWN_DETAILS_LIMIT, BREAKDOWN_PRESETS, MAX_SELECTED_EVENT_BREAKDOWN_PROPERTIES } from './consts'+import {+ buildBreakdownProperties,+ getSelectedEventBreakdownProperties,+ miniBreakdownsLogic,+} from './miniBreakdownsLogic'describe('miniBreakdownsLogic', () => {- let logic: ReturnType<typeof miniBreakdownsLogic.build>+ let filters: ReturnType<typeof issueFiltersLogic.build>+ let breakdowns: ReturnType<typeof miniBreakdownsLogic.build>beforeEach(() => {useMocks({- post: {- '/api/environments/:team_id/query/': { results: {} },+ get: {+ '/api/environments/:team_id/quick_filters/': { results: [] },+ '/api/environments/:team_id/error_tracking/issues/:id/': {},+ '/api/environments/:team_id/error_tracking/fingerprints': { results: [] },+ '/api/environments/:team_id/error_tracking/spike_events': { results: [] },+ '/api/projects/:team_id/signals/reports/': { results: [] },},})initKeaTests()- logic = miniBreakdownsLogic({ issueId: 'issue-1' })- logic.mount()+ jest.spyOn(api, 'query').mockResolvedValue({ results: {} } as ErrorTrackingBreakdownsQueryResponse)+ filters = issueFiltersLogic({ logicKey: ERROR_TRACKING_ISSUE_SCENE_LOGIC_KEY })+ filters.mount()+ breakdowns = miniBreakdownsLogic({ issueId: 'issue-id' })+ breakdowns.mount()})- afterEach(() => logic?.unmount())+ afterEach(() => {+ breakdowns.unmount()+ filters.unmount()+ jest.restoreAllMocks()+ })- // There used to be no loadResponseFailure reducer at all, so a failed breakdowns query left- // response/responseLoading unchanged — indistinguishable from "query returned nothing" and- // with no way to retry. It must surface the error and clear it on retry.it('surfaces and clears a response load failure', () => {- logic.actions.loadResponseFailure('Failed to load breakdowns')- expect(logic.values.responseError).toBe('Failed to load breakdowns')+ breakdowns.actions.loadResponseFailure('Failed to load breakdowns')+ expect(breakdowns.values.responseError).toBe('Failed to load breakdowns')++ breakdowns.actions.loadResponse()+ expect(breakdowns.values.responseError).toBeNull()+ })++ it('adds primitive properties from the selected event without duplicating configured breakdowns', async () => {+ const properties = {+ $browser: 'Chrome',+ account_tier: 'paid',+ attempt: 2,+ enabled: true,+ nested: { source: 'checkout' },+ tags: ['web'],+ }+ const selectedEventProperties = getSelectedEventBreakdownProperties(properties, false)++ expect(buildBreakdownProperties(selectedEventProperties)).toEqual([+ ...BREAKDOWN_PRESETS,+ { property: 'account_tier', title: 'account_tier' },+ { property: 'attempt', title: 'attempt' },+ { property: 'enabled', title: 'enabled' },+ ])++ const issueScene = errorTrackingIssueSceneLogic({ id: 'issue-id' })+ await expectLogic(breakdowns, () => {+ issueScene.actions.selectEvent({+ event: '$exception',+ uuid: 'event-id',+ timestamp: '2026-08-13T12:00:00Z',+ distinct_id: 'person-id',+ properties,+ person: { id: 'person-id', distinct_ids: ['person-id'], properties: {} },+ } as ErrorEventType)+ }).toFinishAllListeners()++ expect(breakdowns.values.breakdownProperties).toEqual([+ ...BREAKDOWN_PRESETS,+ { property: 'account_tier', title: 'account_tier' },+ { property: 'attempt', title: 'attempt' },+ { property: 'enabled', title: 'enabled' },+ ])+ })++ it('caps the breakdown properties auto-derived from the selected event', () => {+ const properties = Object.fromEntries(+ Array.from({ length: MAX_SELECTED_EVENT_BREAKDOWN_PROPERTIES + 5 }, (_, index) => [+ `custom_prop_${String(index).padStart(2, '0')}`,+ 'value',+ ])+ )++ expect(getSelectedEventBreakdownProperties(properties, false)).toHaveLength(+ MAX_SELECTED_EVENT_BREAKDOWN_PROPERTIES+ )+ })++ it('loads the expanded value set when opening breakdown details', async () => {+ await expectLogic(breakdowns).toFinishAllListeners()+ const breakdown = BREAKDOWN_PRESETS[0]++ await expectLogic(breakdowns, () => {+ breakdowns.actions.openBreakdownDetails(breakdown)+ })+ .toDispatchActions(['openBreakdownDetails', 'loadBreakdownDetails', 'loadBreakdownDetailsSuccess'])+ .toFinishAllListeners()++ expect(breakdowns.values.selectedBreakdownProperty).toEqual(breakdown)+ const detailsQuery = jest.mocked(api.query).mock.calls.at(-1)?.[0] as ErrorTrackingBreakdownsQuery+ expect(detailsQuery.breakdownProperties).toEqual([breakdown.property])+ expect(detailsQuery.maxValuesPerProperty).toBe(BREAKDOWN_DETAILS_LIMIT)++ breakdowns.actions.closeBreakdownDetails()+ expect(breakdowns.values.selectedBreakdownProperty).toBeNull()+ })++ it('discards details returned for a property that was superseded', async () => {+ await expectLogic(breakdowns).toFinishAllListeners()+ let resolveFirstRequest: (response: ErrorTrackingBreakdownsQueryResponse) => void = () => {}+ let markFirstRequestStarted: () => void = () => {}+ const firstRequestStarted = new Promise<void>((resolve) => {+ markFirstRequestStarted = resolve+ })+ const firstResponse: ErrorTrackingBreakdownsQueryResponse = {+ results: { $browser: { values: [], total_count: 0 } },+ }+ const secondResponse: ErrorTrackingBreakdownsQueryResponse = {+ results: { $device_type: { values: [], total_count: 0 } },+ }+ const queryMock = jest.mocked(api.query)+ const existingCallCount = queryMock.mock.calls.length+ queryMock+ .mockImplementationOnce(+ () =>+ new Promise((resolve) => {+ resolveFirstRequest = resolve+ markFirstRequestStarted()+ })+ )+ .mockResolvedValueOnce(secondResponse)++ breakdowns.actions.openBreakdownDetails(BREAKDOWN_PRESETS[0])+ await firstRequestStarted+ expect(queryMock.mock.calls).toHaveLength(existingCallCount + 1)+ await expectLogic(breakdowns, () => {+ breakdowns.actions.openBreakdownDetails(BREAKDOWN_PRESETS[1])+ }).toDispatchActions(['loadBreakdownDetailsSuccess'])+ expect(breakdowns.values.breakdownDetails).toEqual(secondResponse)- logic.actions.loadResponse()- expect(logic.values.responseError).toBeNull()+ resolveFirstRequest(firstResponse)+ await expectLogic(breakdowns).toFinishAllListeners()+ expect(breakdowns.values.breakdownDetails).toEqual(secondResponse)})})diff --git a/products/error_tracking/frontend/components/Breakdowns/miniBreakdownsLogic.ts b/products/error_tracking/frontend/components/Breakdowns/miniBreakdownsLogic.tsindex 533ace0197d1..b9aff6768bef 100644--- a/products/error_tracking/frontend/components/Breakdowns/miniBreakdownsLogic.ts+++ b/products/error_tracking/frontend/components/Breakdowns/miniBreakdownsLogic.ts@@ -1,20 +1,33 @@-import { MakeLogicType, connect, events, kea, key, path, props, reducers, selectors } from 'kea'+import { MakeLogicType, actions, connect, events, kea, key, listeners, path, props, reducers, selectors } from 'kea'import { loaders } from 'kea-loaders'import { subscriptions } from 'kea-subscriptions'import posthog from 'posthog-js'import api from 'lib/api'+import type { ErrorEventProperties, ErrorEventType } from 'lib/components/Errors/types'+import { getAdditionalProperties } from 'lib/components/Errors/utils'+import { TaxonomicFilterGroupType } from 'lib/components/TaxonomicFilter/types'+import { preflightLogic } from 'lib/logic/preflightLogic'import { BREAKDOWN_OTHER_DISPLAY } from 'scenes/insights/utils'import {CachedErrorTrackingBreakdownsQueryResponse,+ DateRange,ErrorTrackingBreakdownsQueryResponse,} from '~/queries/schema/schema-general'+import { getCoreFilterDefinition } from '~/taxonomy/helpers'-import type { DateRange } from '../../../../../frontend/src/queries/schema/schema-general'import { errorTrackingBreakdownsQuery } from '../../queries'-import { breakdownFiltersLogic } from './breakdownFiltersLogic'-import { BREAKDOWN_PRESETS, BreakdownsEvents, LIMIT_ITEMS } from './consts'+import { errorTrackingIssueSceneLogic } from '../../scenes/ErrorTrackingIssueScene/errorTrackingIssueSceneLogic'+import { ERROR_TRACKING_ISSUE_SCENE_LOGIC_KEY, issueFiltersLogic } from '../IssueFilters/issueFiltersLogic'+import {+ BREAKDOWN_DETAILS_LIMIT,+ BREAKDOWN_PRESETS,+ BreakdownPreset,+ BreakdownsEvents,+ LIMIT_ITEMS,+ MAX_SELECTED_EVENT_BREAKDOWN_PROPERTIES,+} from './consts'export interface MiniBreakdownsLogicProps {issueId: string@@ -25,10 +38,74 @@ export interface BreakdownSinglePropertyStat {count: number}+function getBreakdownPropertyTitle(property: string): string {+ return getCoreFilterDefinition(property, TaxonomicFilterGroupType.EventProperties)?.label ?? property+}++export function getSelectedEventBreakdownProperties(+ properties: ErrorEventProperties | null,+ isCloudOrDev: boolean | undefined+): BreakdownPreset[] {+ if (!properties) {+ return []+ }++ return Object.entries(getAdditionalProperties(properties, isCloudOrDev))+ .filter(([, value]) => value === null || ['string', 'number', 'boolean'].includes(typeof value))+ .map(([property]) => ({ property, title: getBreakdownPropertyTitle(property) }))+ .sort((left, right) => left.title.localeCompare(right.title, undefined, { sensitivity: 'base' }))+ .slice(0, MAX_SELECTED_EVENT_BREAKDOWN_PROPERTIES)+}++export function getBreakdownForPropertyFromResponse(+ response: ErrorTrackingBreakdownsQueryResponse | null,+ property: string+): { properties: BreakdownSinglePropertyStat[]; totalCount: number } {+ const properties: BreakdownSinglePropertyStat[] = []+ let totalCount = 0+ const propertyData = response?.results?.[property]++ if (propertyData) {+ propertyData.values.forEach((value) => {+ properties.push({+ label: value.value,+ count: value.count,+ })+ })++ totalCount = propertyData.total_count || 0++ const displayedCount = propertyData.values.reduce((sum, value) => sum + value.count, 0)+ const otherCount = Math.max(0, totalCount - displayedCount)+ if (otherCount > 0) {+ properties.push({+ label: BREAKDOWN_OTHER_DISPLAY,+ count: otherCount,+ })+ }+ }++ return { properties, totalCount }+}++export function buildBreakdownProperties(selectedEventBreakdownProperties: BreakdownPreset[]): BreakdownPreset[] {+ const presetPropertyNames = new Set(BREAKDOWN_PRESETS.map(({ property }) => property))+ return [+ ...BREAKDOWN_PRESETS,+ ...selectedEventBreakdownProperties.filter(({ property }) => !presetPropertyNames.has(property)),+ ]+}+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.export interface miniBreakdownsLogicValues {- dateRange: DateRange // breakdownFiltersLogic- filterTestAccounts: boolean // breakdownFiltersLogic+ selectedEvent: ErrorEventType | null // errorTrackingIssueSceneLogic+ dateRange: DateRange // issueFiltersLogic+ filterTestAccounts: boolean // issueFiltersLogic+ isCloudOrDev: boolean | undefined // preflightLogic+ breakdownDetails: ErrorTrackingBreakdownsQueryResponse | null+ breakdownDetailsError: string | null+ breakdownDetailsLoading: boolean+ breakdownProperties: BreakdownPreset[]getBreakdownForProperty: (property: string) => {properties: BreakdownSinglePropertyStat[]totalCount: number@@ -36,11 +113,39 @@ export interface miniBreakdownsLogicValues {response: ErrorTrackingBreakdownsQueryResponse | nullresponseError: string | nullresponseLoading: boolean+ selectedBreakdownProperty: BreakdownPreset | null+ selectedEventBreakdownProperties: BreakdownPreset[]}// Generated by kea-typegen. Update if you're an agent, ignore if you're human.export interface miniBreakdownsLogicActions {- loadResponse: () => any+ closeBreakdownDetails: () => {+ value: true+ }+ loadBreakdownDetails: ({ property }: { property: string }) => {+ property: string+ }+ loadBreakdownDetailsFailure: (+ error: string,+ errorObject?: any+ ) => {+ error: string+ errorObject?: any+ }+ loadBreakdownDetailsSuccess: (+ breakdownDetails: ErrorTrackingBreakdownsQueryResponse,+ payload?: {+ property: string+ }+ ) => {+ breakdownDetails: ErrorTrackingBreakdownsQueryResponse+ payload?: {+ property: string+ }+ }+ loadResponse: () => {+ value: true+ }loadResponseFailure: (error: string,errorObject?: any@@ -50,10 +155,17 @@ export interface miniBreakdownsLogicActions {}loadResponseSuccess: (response: ErrorTrackingBreakdownsQueryResponse,- payload?: any+ payload?: {+ value: true+ }) => {response: ErrorTrackingBreakdownsQueryResponse- payload?: any+ payload?: {+ value: true+ }+ }+ openBreakdownDetails: (breakdown: BreakdownPreset) => {+ breakdown: BreakdownPreset}}@@ -61,6 +173,11 @@ export interface miniBreakdownsLogicActions {export interface miniBreakdownsLogicMeta {key: string__keaTypeGenInternalSelectorTypes: {+ selectedEventBreakdownProperties: (+ selectedEvent: ErrorEventType | null,+ isCloudOrDev: boolean | undefined+ ) => BreakdownPreset[]+ breakdownProperties: (selectedEventBreakdownProperties: BreakdownPreset[]) => BreakdownPreset[]getBreakdownForProperty: (response: ErrorTrackingBreakdownsQueryResponse | null) => (property: string) => {properties: BreakdownSinglePropertyStat[]totalCount: number@@ -79,10 +196,38 @@ export const miniBreakdownsLogic = kea<miniBreakdownsLogicType>([path(['products', 'error_tracking', 'components', 'Breakdowns', 'miniBreakdownsLogic']),props({} as MiniBreakdownsLogicProps),key(({ issueId }: MiniBreakdownsLogicProps) => issueId),- connect(() => ({- values: [breakdownFiltersLogic, ['dateRange', 'filterTestAccounts']],+ connect((props: MiniBreakdownsLogicProps) => ({+ values: [+ issueFiltersLogic({ logicKey: ERROR_TRACKING_ISSUE_SCENE_LOGIC_KEY }),+ ['dateRange', 'filterTestAccounts'],+ errorTrackingIssueSceneLogic({ id: props.issueId }),+ ['selectedEvent'],+ preflightLogic,+ ['isCloudOrDev'],+ ],})),- reducers(() => ({+ actions({+ closeBreakdownDetails: true,+ loadResponse: true,+ openBreakdownDetails: (breakdown: BreakdownPreset) => ({ breakdown }),+ }),+ reducers({+ selectedBreakdownProperty: [+ null as BreakdownPreset | null,+ {+ openBreakdownDetails: (_, { breakdown }) => breakdown,+ closeBreakdownDetails: () => null,+ },+ ],+ breakdownDetailsError: [+ null as string | null,+ {+ loadBreakdownDetails: () => null,+ loadBreakdownDetailsSuccess: () => null,+ loadBreakdownDetailsFailure: (_, { error }) => error,+ closeBreakdownDetails: () => null,+ },+ ],responseError: [null as string | null,{@@ -91,17 +236,36 @@ export const miniBreakdownsLogic = kea<miniBreakdownsLogicType>([loadResponseFailure: (_, { error }) => error,},],- })),+ }),loaders(({ props, values }) => ({+ breakdownDetails: [+ null as ErrorTrackingBreakdownsQueryResponse | null,+ {+ loadBreakdownDetails: async ({ property }: { property: string }, breakpoint) => {+ const result = await api.query(+ errorTrackingBreakdownsQuery({+ issueId: props.issueId,+ dateRange: values.dateRange,+ filterTestAccounts: values.filterTestAccounts,+ breakdownProperties: [property],+ maxValuesPerProperty: BREAKDOWN_DETAILS_LIMIT,+ }),+ { refresh: 'blocking' }+ )+ breakpoint()+ return result+ },+ },+ ],response: [null as ErrorTrackingBreakdownsQueryResponse | null,{- loadResponse: async () => {+ loadResponse: async (_: { value: true }, breakpoint) => {+ await breakpoint(100)const startTime = Date.now()- // Read connected values up front: the logic (and its connected breakdownFiltersLogic)- // may unmount while the query is in flight, and accessing values afterwards would throw.+ // Read connected values before the request because either connected logic may unmount while it runs.const { dateRange, filterTestAccounts } = values- const breakdownProperties = BREAKDOWN_PRESETS.map((preset) => preset.property)+ const breakdownProperties = values.breakdownProperties.map((preset) => preset.property)const result = await api.query(errorTrackingBreakdownsQuery({issueId: props.issueId,@@ -112,6 +276,7 @@ export const miniBreakdownsLogic = kea<miniBreakdownsLogicType>([}),{ refresh: 'blocking' })+ breakpoint()posthog.capture(BreakdownsEvents.MiniBreakdownsLoaded, {issueId: props.issueId,@@ -128,43 +293,23 @@ export const miniBreakdownsLogic = kea<miniBreakdownsLogicType>([],})),selectors(() => ({+ selectedEventBreakdownProperties: [+ (selectors) => [selectors.selectedEvent, selectors.isCloudOrDev],+ (selectedEvent: ErrorEventType | null, isCloudOrDev: boolean | undefined): BreakdownPreset[] =>+ getSelectedEventBreakdownProperties(selectedEvent?.properties ?? null, isCloudOrDev),+ ],+ breakdownProperties: [+ (selectors) => [selectors.selectedEventBreakdownProperties],+ (selectedEventBreakdownProperties: BreakdownPreset[]) =>+ buildBreakdownProperties(selectedEventBreakdownProperties),+ ],getBreakdownForProperty: [- (s) => [s.response],- (response: ErrorTrackingBreakdownsQueryResponse) => {- return (property: string): { properties: BreakdownSinglePropertyStat[]; totalCount: number } => {- const properties: BreakdownSinglePropertyStat[] = []- let totalCount = 0-- if (response && response.results) {- if (property && response.results[property]) {- const propertyData = response.results[property]-- propertyData.values.forEach((value: any) => {- properties.push({- label: value.value,- count: value.count,- })- })-- totalCount = propertyData.total_count || 0-- const displayedCount = propertyData.values.reduce((sum, value) => sum + value.count, 0)- const otherCount = Math.max(0, totalCount - displayedCount)- if (otherCount > 0) {- properties.push({- label: BREAKDOWN_OTHER_DISPLAY,- count: otherCount,- })- }- }- }-- return { properties, totalCount }- }- },+ (selectors) => [selectors.response],+ (response: ErrorTrackingBreakdownsQueryResponse | null) =>+ (property: string): { properties: BreakdownSinglePropertyStat[]; totalCount: number } =>+ getBreakdownForPropertyFromResponse(response, property),],})),-subscriptions(({ actions }) => ({dateRange: (value, oldValue) => {if (oldValue !== undefined && value !== oldValue) {@@ -176,8 +321,17 @@ export const miniBreakdownsLogic = kea<miniBreakdownsLogicType>([actions.loadResponse()}},+ selectedEventBreakdownProperties: (value: BreakdownPreset[], oldValue: BreakdownPreset[] | undefined) => {+ const propertyNames = value.map(({ property }) => property).join('\0')+ const previousPropertyNames = oldValue?.map(({ property }) => property).join('\0')+ if (oldValue !== undefined && propertyNames !== previousPropertyNames) {+ actions.loadResponse()+ }+ },+ })),+ listeners(({ actions }) => ({+ openBreakdownDetails: ({ breakdown }) => actions.loadBreakdownDetails({ property: breakdown.property }),})),-events(({ actions }) => ({afterMount: () => {actions.loadResponse()diff --git a/products/error_tracking/frontend/components/ContextDisplay/ContextDisplay.tsx b/products/error_tracking/frontend/components/ContextDisplay/ContextDisplay.tsxindex fe2042f42120..f9cf1ad24608 100644--- a/products/error_tracking/frontend/components/ContextDisplay/ContextDisplay.tsx+++ b/products/error_tracking/frontend/components/ContextDisplay/ContextDisplay.tsx@@ -1,23 +1,13 @@-import { useActions, useValues } from 'kea'+import { useActions } from 'kea'import { match } from 'ts-pattern'import { Spinner } from '@posthog/lemon-ui'import { ExceptionAttributes } from 'lib/components/Errors/types'import { concatValues } from 'lib/components/Errors/utils'-import { isUniversalGroupFilterLike } from 'lib/components/UniversalFilters/utils'import { identifierToHuman } from 'lib/utils/strings'-import {- AnyPropertyFilter,- FilterLogicalOperator,- PropertyFilterType,- PropertyOperator,- UniversalFiltersGroup,-} from '~/types'--import { ERROR_TRACKING_ISSUE_SCENE_LOGIC_KEY } from '../../scenes/ErrorTrackingIssueScene/errorTrackingIssueSceneLogic'-import { issueFiltersLogic } from '../IssueFilters/issueFiltersLogic'+import { ERROR_TRACKING_ISSUE_SCENE_LOGIC_KEY, issueFiltersLogic } from '../IssueFilters/issueFiltersLogic'import { PropertiesTable } from '../PropertiesTable'export type ContextDisplayProps = {@@ -31,32 +21,9 @@ export function ContextDisplay({exceptionAttributes,additionalProperties,}: ContextDisplayProps): JSX.Element {- const { filterGroup } = useValues(issueFiltersLogic({ logicKey: ERROR_TRACKING_ISSUE_SCENE_LOGIC_KEY }))- const { setFilterGroup } = useActions(issueFiltersLogic({ logicKey: ERROR_TRACKING_ISSUE_SCENE_LOGIC_KEY }))+ const { addPropertyFilter } = useActions(issueFiltersLogic({ logicKey: ERROR_TRACKING_ISSUE_SCENE_LOGIC_KEY }))const onFilterValue = (key: string, value: string | number | boolean): void => {- const firstValue = filterGroup.values[0]- const firstGroup: UniversalFiltersGroup = isUniversalGroupFilterLike(firstValue)- ? firstValue- : {- type: FilterLogicalOperator.And,- values: firstValue ? [firstValue] : [],- }- const newFilter: AnyPropertyFilter = {- key,- type: PropertyFilterType.Event,- operator: PropertyOperator.Exact,- value: [value],- }- setFilterGroup({- type: FilterLogicalOperator.And,- values: [- {- ...firstGroup,- values: [...firstGroup.values, newFilter],- },- ...filterGroup.values.slice(1),- ],- })+ addPropertyFilter(key, value)}const additionalEntries = Object.entries(additionalProperties).sort(([leftKey], [rightKey]) => leftKey.localeCompare(rightKey, undefined, { sensitivity: 'base' }))diff --git a/products/error_tracking/frontend/components/EventsTable/EventsTable.test.tsx b/products/error_tracking/frontend/components/EventsTable/EventsTable.test.tsxnew file mode 100644index 000000000000..9c933fa1215b--- /dev/null+++ b/products/error_tracking/frontend/components/EventsTable/EventsTable.test.tsx@@ -0,0 +1,81 @@+import '@testing-library/jest-dom'++import { cleanup, render } from '@testing-library/react'++import type { ErrorEventType } from 'lib/components/Errors/types'++import { EventsTable } from './EventsTable'++const event = {+ event: '$exception',+ uuid: 'event-1',+ timestamp: '2026-01-01T00:00:00Z',+ distinct_id: 'person-1',+ person: { distinct_ids: ['person-1'], properties: {} },+ properties: {+ $exception_types: ['TypeError'],+ $exception_values: ['Something failed'],+ },+} as ErrorEventType++const secondEvent = { ...event, uuid: 'event-2' } as ErrorEventType++describe('EventsTable', () => {+ afterEach(() => cleanup())++ it('scrolls the selected event into view when it first appears', () => {+ const scrollIntoView = jest.fn()+ Element.prototype.scrollIntoView = scrollIntoView++ render(+ <EventsTable+ items={[event]}+ hasMore={false}+ loading={false}+ selectedEvent={event}+ onEventSelect={jest.fn()}+ onLoadMore={jest.fn()}+ />+ )++ expect(scrollIntoView).toHaveBeenCalledWith({ block: 'nearest' })+ })++ it('does not re-scroll when a pagination request toggles loading for the same selection', () => {+ const scrollIntoView = jest.fn()+ Element.prototype.scrollIntoView = scrollIntoView+ const props = {+ items: [event],+ hasMore: true,+ selectedEvent: event,+ onEventSelect: jest.fn(),+ onLoadMore: jest.fn(),+ }+ const { rerender } = render(<EventsTable {...props} loading={false} />)+ scrollIntoView.mockClear()++ // Loading a further page flips loading true then false while the selection is unchanged.+ rerender(<EventsTable {...props} loading />)+ rerender(<EventsTable {...props} loading={false} />)++ expect(scrollIntoView).not.toHaveBeenCalled()+ })++ it('scrolls to the newly selected event when the selection changes', () => {+ const scrollIntoView = jest.fn()+ Element.prototype.scrollIntoView = scrollIntoView+ const props = {+ items: [event, secondEvent],+ hasMore: false,+ loading: false,+ onEventSelect: jest.fn(),+ onLoadMore: jest.fn(),+ }+ const { rerender } = render(<EventsTable {...props} selectedEvent={event} />)+ scrollIntoView.mockClear()++ rerender(<EventsTable {...props} selectedEvent={secondEvent} />)++ expect(scrollIntoView).toHaveBeenCalledWith({ block: 'nearest' })+ })+})diff --git a/products/error_tracking/frontend/components/EventsTable/EventsTable.tsx b/products/error_tracking/frontend/components/EventsTable/EventsTable.tsxindex d3193b25cb74..876b0b5056de 100644--- a/products/error_tracking/frontend/components/EventsTable/EventsTable.tsx+++ b/products/error_tracking/frontend/components/EventsTable/EventsTable.tsx@@ -1,3 +1,5 @@+import { useEffect, useRef } from 'react'+import { Link } from '@posthog/lemon-ui'import { ErrorEventType } from 'lib/components/Errors/types'@@ -108,8 +110,19 @@ function EventRow({lastEventUuid?: stringonSelect: (event: ErrorEventType) => void}): JSX.Element {+ const rowRef = useRef<HTMLTableRowElement>(null)++ // Scroll only when this row becomes the selected one. Depending on the list's loading state+ // would re-fire on every pagination request and yank the list back to the selection.+ useEffect(() => {+ if (selected) {+ rowRef.current?.scrollIntoView({ block: 'nearest' })+ }+ }, [selected])+return (<TableRow+ ref={rowRef}data-state={selected ? 'selected' : undefined}className={cn('cursor-pointer',diff --git a/products/error_tracking/frontend/components/InternalAccountsToggle.tsx b/products/error_tracking/frontend/components/InternalAccountsToggle.tsxindex efc52369b08f..d1e2f5d586cb 100644--- a/products/error_tracking/frontend/components/InternalAccountsToggle.tsx+++ b/products/error_tracking/frontend/components/InternalAccountsToggle.tsx@@ -1,20 +1,9 @@import { useActions, useValues } from 'kea'-import { IconGear } from '@posthog/icons'+import { IconBuilding, IconExternal } from '@posthog/icons'+import { LemonMenu, LemonSwitch } from '@posthog/lemon-ui'-import { LinkPrimitive } from 'lib/lemon-ui/Link'-import {- Button,- ButtonGroup,- ButtonGroupText,- buttonVariants,- cn,- Label,- Switch,- Tooltip,- TooltipContent,- TooltipTrigger,-} from 'lib/ui/quill'+import { Button } from 'lib/ui/quill'import { filterTestAccountsDefaultsLogic } from 'scenes/settings/environment/filterTestAccountDefaultsLogic'import { teamLogic } from 'scenes/teamLogic'import { urls } from 'scenes/urls'@@ -36,49 +25,62 @@ export const InternalAccountsToggle = ({const { setLocalDefault } = useActions(filterTestAccountsDefaultsLogic)const hasFilters = (currentTeam?.test_account_filters || []).length > 0const disabledReason = hasFilters ? undefined : "You haven't set any internal and test filters"+ const isFiltering = hasFilters && filterTestAccountsreturn (- <ButtonGroup className="shrink-0" title={disabledReason}>- <Tooltip>- <TooltipTrigger- render={- <Button- variant="outline"- size="icon"- render={- <LinkPrimitive- to={urls.settings('environment-customization', 'internal-user-filtering')}- />- }- aria-label="Configure internal user filters"+ <LemonMenu+ placement="bottom-end"+ closeOnClickInside={false}+ items={[+ {+ custom: true,+ label: () => (+ <LemonSwitch+ id={id}+ className="min-h-8"+ size="small"+ fullWidth+ checked={isFiltering}+ disabledReason={disabledReason}+ onChange={(checked) => {+ onChange(checked)+ setLocalDefault(checked)+ }}+ label="Exclude internal users"+ labelClassName="text-sm"+ data-attr="error-tracking-exclude-internal-users"/>+ ),+ },+ {+ label: 'Configure internal user filters',+ to: urls.settings('environment-customization', 'internal-user-filtering'),+ targetBlank: true,+ sideIcon: <IconExternal />,+ },+ ]}+ >+ <Button+ variant="default"+ size="icon"+ aria-label="Internal user filters"+ aria-pressed={isFiltering}+ title="Internal user filters"+ data-attr="error-tracking-internal-user-filters"+ >+ <span+ className={+ isFiltering+ ? 'relative flex size-4 items-center justify-center text-[var(--primary)]'+ : 'flex size-4 items-center justify-center'}>- <IconGear />- </TooltipTrigger>- <TooltipContent>Configure internal user filters</TooltipContent>- </Tooltip>- {/*- * ButtonGroupText ships no frame, so this segment borrows the outline button's own- * variant classes rather than re-deriving its border and fill, which is how the two- * segments stay identical. It isn't a button, so the pointer cursor is dropped.- */}- <ButtonGroupText className={cn(buttonVariants({ variant: 'outline', size: 'default' }), 'cursor-default')}>- <Label htmlFor={id} className="whitespace-nowrap">- Exclude internal users- </Label>- <Switch- id={id}- size="default"- checked={hasFilters && filterTestAccounts}- disabled={!hasFilters}- onCheckedChange={(checked) => {- onChange(checked)- setLocalDefault(checked)- }}- aria-label="Exclude internal users"- />- </ButtonGroupText>- </ButtonGroup>+ <IconBuilding className={isFiltering ? 'size-4 text-[var(--primary)]' : 'size-4'} />+ {isFiltering && (+ <span className="absolute h-px w-5 -rotate-45 rounded-full bg-current" aria-hidden />+ )}+ </span>+ </Button>+ </LemonMenu>)}diff --git a/products/error_tracking/frontend/components/IssueFilterPreview/IssueFilterPreviewHeader.tsx b/products/error_tracking/frontend/components/IssueFilterPreview/IssueFilterPreviewHeader.tsxnew file mode 100644index 000000000000..d8155b8a441a--- /dev/null+++ b/products/error_tracking/frontend/components/IssueFilterPreview/IssueFilterPreviewHeader.tsx@@ -0,0 +1,49 @@+import { useActions, useValues } from 'kea'+import type { ReactNode } from 'react'++import { IconArrowLeft } from '@posthog/icons'+import { Tooltip as LemonTooltip } from '@posthog/lemon-ui'++import { Button, Heading } from 'lib/ui/quill'++import { IssueFilterPreview, issueFilterPreviewLogic } from './issueFilterPreviewLogic'++interface IssueFilterPreviewHeaderProps {+ preview: IssueFilterPreview+ title: string+ children?: ReactNode+}++export function IssueFilterPreviewHeader({ preview, title, children }: IssueFilterPreviewHeaderProps): JSX.Element {+ const { activePreview, canUndoActivePreview } = useValues(issueFilterPreviewLogic)+ const { undoActivePreview } = useActions(issueFilterPreviewLogic)+ const canUndo = activePreview === preview && canUndoActivePreview++ return (+ <div className="sticky top-0 z-10 flex h-10 shrink-0 items-center justify-between gap-2 border-b border-primary bg-[var(--background)] px-3">+ <div className="flex shrink-0 items-center gap-1.5">+ {canUndo && (+ <div className="flex size-6 shrink-0 items-center justify-center">+ <LemonTooltip title="Undo filter">+ <Button+ variant="default"+ size="icon-sm"+ aria-label="Undo filter"+ data-attr="error-tracking-undo-preview-filter"+ onClick={undoActivePreview}+ >+ <IconArrowLeft />+ </Button>+ </LemonTooltip>+ </div>+ )}+ <Heading size="sm">{title}</Heading>+ </div>+ {children ? (+ <div className="hide-scrollbar h-full min-w-0 flex-1 overflow-x-auto overflow-y-hidden">+ <div className="flex h-full w-max min-w-full items-center justify-end">{children}</div>+ </div>+ ) : null}+ </div>+ )+}diff --git a/products/error_tracking/frontend/components/IssueFilterPreview/IssueFilterPreviewPanel.tsx b/products/error_tracking/frontend/components/IssueFilterPreview/IssueFilterPreviewPanel.tsxnew file mode 100644index 000000000000..37dd20de8f33--- /dev/null+++ b/products/error_tracking/frontend/components/IssueFilterPreview/IssueFilterPreviewPanel.tsx@@ -0,0 +1,93 @@+import { useActions, useValues } from 'kea'+import type { PropsWithChildren, UIEvent } from 'react'++import { IconClock, IconListTree } from '@posthog/icons'++import { Tabs, TabsContent, TabsList, TabsTrigger, Tooltip, TooltipContent, TooltipTrigger } from 'lib/ui/quill'++import { MiniBreakdowns } from '../Breakdowns/MiniBreakdowns'+import { issueFilterPreviewLogic } from './issueFilterPreviewLogic'+import { TimeFilterPreview } from './TimeFilterPreview'++interface IssueFilterPreviewPanelProps {+ className?: string+ onScrollNearEnd?: () => void+}++export function IssueFilterPreviewPanel({+ children,+ className,+ onScrollNearEnd,+}: PropsWithChildren<IssueFilterPreviewPanelProps>): JSX.Element {+ const { activePreview } = useValues(issueFilterPreviewLogic)+ const { setActivePreview } = useActions(issueFilterPreviewLogic)++ const handleScroll = (event: UIEvent<HTMLDivElement>): void => {+ const { clientHeight, scrollHeight, scrollTop } = event.currentTarget+ if (scrollHeight - scrollTop - clientHeight <= 400) {+ onScrollNearEnd?.()+ }+ }++ return (+ <div className={className}>+ <div className="flex min-h-0 flex-1 flex-col overflow-y-auto overscroll-y-none" onScroll={handleScroll}>+ <div className="max-h-1/2 shrink-0 overflow-y-auto overscroll-y-none">+ <Tabs+ orientation="vertical"+ value={activePreview}+ onValueChange={(preview) => {+ if (preview === 'time' || preview === 'properties') {+ setActivePreview(preview)+ }+ }}+ data-quill+ className="relative items-stretch gap-0 bg-[var(--background)] after:pointer-events-none after:absolute after:inset-y-0 after:left-10 after:z-10 after:border-l after:border-primary after:content-['']"+ >+ <TabsList+ variant="line"+ aria-label="Issue filter previews"+ className="sticky top-0 z-20 !h-auto w-10 shrink-0 justify-start self-start rounded-none bg-[var(--background)] p-1"+ >+ <Tooltip>+ <TooltipTrigger+ render={+ <TabsTrigger+ value="time"+ aria-label="Time"+ className="!size-8 !flex-none !justify-center !p-0"+ />+ }+ >+ <IconClock />+ </TooltipTrigger>+ <TooltipContent side="right">Time</TooltipContent>+ </Tooltip>+ <Tooltip>+ <TooltipTrigger+ render={+ <TabsTrigger+ value="properties"+ aria-label="Properties"+ className="!size-8 !flex-none !justify-center !p-0"+ />+ }+ >+ <IconListTree />+ </TooltipTrigger>+ <TooltipContent side="right">Properties</TooltipContent>+ </Tooltip>+ </TabsList>+ <TabsContent value="time" className="min-w-0 !flex-none flex-1">+ <TimeFilterPreview />+ </TabsContent>+ <TabsContent value="properties" className="min-w-0 !flex-none flex-1">+ <MiniBreakdowns />+ </TabsContent>+ </Tabs>+ </div>+ {children}+ </div>+ </div>+ )+}diff --git a/products/error_tracking/frontend/components/IssueFilterPreview/TimeFilterPreview.tsx b/products/error_tracking/frontend/components/IssueFilterPreview/TimeFilterPreview.tsxnew file mode 100644index 000000000000..876e563c63d4--- /dev/null+++ b/products/error_tracking/frontend/components/IssueFilterPreview/TimeFilterPreview.tsx@@ -0,0 +1,91 @@+import { useActions, useValues } from 'kea'+import { useCallback, useMemo, useRef } from 'react'++import { ErrorTrackingSpikeEvent } from 'lib/components/Errors/types'++import { useSparklineDataIssueScene } from '../../hooks/use-sparkline-data'+import { useSparklineEvents } from '../../hooks/use-sparkline-events'+import { errorTrackingIssueSceneLogic } from '../../scenes/ErrorTrackingIssueScene/errorTrackingIssueSceneLogic'+import { cancelEvent } from '../../utils'+import { SpikeDetailsPopover } from '../SpikeDetailsPopover'+import { errorTrackingVolumeSparklineLogic } from '../VolumeSparkline/errorTrackingVolumeSparklineLogic'+import type { SparklineDatum } from '../VolumeSparkline/types'+import { VolumeSparkline } from '../VolumeSparkline/VolumeSparkline'+import { issueFilterPreviewLogic } from './issueFilterPreviewLogic'+import { TimeFilterPreviewHeader } from './TimeFilterPreviewHeader'++export function TimeFilterPreview(): JSX.Element {+ const { issueId, spikeEvents } = useValues(errorTrackingIssueSceneLogic)+ const sparklineKey = issueId || 'issue-unknown'+ const { clickedSpike } = useValues(errorTrackingVolumeSparklineLogic({ sparklineKey }))+ const { setClickedSpike } = useActions(errorTrackingVolumeSparklineLogic({ sparklineKey }))+ const { applyDateRangeFilter } = useActions(issueFilterPreviewLogic)+ const sparklineData = useSparklineDataIssueScene()+ const sparklineEvents = useSparklineEvents()+ const sparklineContainerRef = useRef<HTMLDivElement | null>(null)++ const handleRangeSelect = useCallback(+ (startDate: Date, endDate: Date) => {+ setClickedSpike(null)+ applyDateRangeFilter({+ date_from: startDate.toISOString(),+ date_to: endDate.toISOString(),+ })+ },+ [applyDateRangeFilter, setClickedSpike]+ )++ const handleSpikeClick = useCallback(+ (datum: SparklineDatum, clientX: number, clientY: number) => {+ setClickedSpike({ datum, clientX, clientY })+ },+ [setClickedSpike]+ )++ const matchedSpikeEvent = useMemo<ErrorTrackingSpikeEvent | null>(() => {+ if (!clickedSpike || sparklineData.length < 2) {+ return null+ }+ const binSizeMs = sparklineData[1].date.getTime() - sparklineData[0].date.getTime()+ const binStart = clickedSpike.datum.date.getTime()+ return (+ (spikeEvents as ErrorTrackingSpikeEvent[]).find((spikeEvent) => {+ const detectedAt = new Date(spikeEvent.detected_at).getTime()+ return detectedAt >= binStart && detectedAt < binStart + binSizeMs+ }) ?? null+ )+ }, [clickedSpike, spikeEvents, sparklineData])++ return (+ <div className="relative flex flex-col">+ <TimeFilterPreviewHeader sparklineKey={sparklineKey} />+ <div+ onClick={cancelEvent}+ ref={sparklineContainerRef}+ className="relative flex h-56 w-full flex-col px-2 py-3"+ >+ <VolumeSparkline+ data={sparklineData}+ layout="detailed"+ xAxis="full"+ events={sparklineEvents}+ sparklineKey={sparklineKey}+ className="h-full"+ onRangeSelect={handleRangeSelect}+ onBucketClick={handleRangeSelect}+ onSpikeClick={handleSpikeClick}+ />+ </div>+ {clickedSpike && (+ <SpikeDetailsPopover+ datum={clickedSpike.datum}+ clientX={clickedSpike.clientX}+ clientY={clickedSpike.clientY}+ spikeEvent={matchedSpikeEvent}+ onClose={() => setClickedSpike(null)}+ sparklineContainerRef={sparklineContainerRef}+ />+ )}+ </div>+ )+}diff --git a/products/error_tracking/frontend/components/IssueFilterPreview/TimeFilterPreviewHeader.tsx b/products/error_tracking/frontend/components/IssueFilterPreview/TimeFilterPreviewHeader.tsxnew file mode 100644index 000000000000..9aa3b8935c7e--- /dev/null+++ b/products/error_tracking/frontend/components/IssueFilterPreview/TimeFilterPreviewHeader.tsx@@ -0,0 +1,117 @@+import { useValues } from 'kea'+import { match } from 'ts-pattern'++import { IconTrending } from '@posthog/icons'+import { Tooltip as LemonTooltip } from '@posthog/lemon-ui'++import { dayjs } from 'lib/dayjs'+import { Skeleton } from 'lib/ui/quill'+import { humanFriendlyLargeNumber } from 'lib/utils/numbers'+import { shortTimeZone } from 'lib/utils/timezones'+import { teamLogic } from 'scenes/teamLogic'++import { ErrorTrackingIssueAggregations } from '~/queries/schema/schema-general'++import { errorTrackingIssueSceneLogic } from '../../scenes/ErrorTrackingIssueScene/errorTrackingIssueSceneLogic'+import { errorTrackingVolumeSparklineLogic } from '../VolumeSparkline/errorTrackingVolumeSparklineLogic'+import type { SparklineDatum, SparklineEvent, VolumeSparklineHoverSelection } from '../VolumeSparkline/types'+import { IssueFilterPreviewHeader } from './IssueFilterPreviewHeader'++interface TimeFilterPreviewHeaderProps {+ sparklineKey: string+}++/** Owns the hover selection so moving across the chart does not re-render the chart subtree. */+export function TimeFilterPreviewHeader({ sparklineKey }: TimeFilterPreviewHeaderProps): JSX.Element {+ const { aggregations, summaryLoading } = useValues(errorTrackingIssueSceneLogic)+ const { hoverSelection } = useValues(errorTrackingVolumeSparklineLogic({ sparklineKey }))+ const { timezone } = useValues(teamLogic)++ return (+ <IssueFilterPreviewHeader preview="time" title="Volume">+ {match(hoverSelection)+ .when(+ (data) => shouldRenderIssueMetrics(data),+ () => <IssueMetrics aggregations={aggregations} summaryLoading={summaryLoading} />+ )+ .with({ kind: 'bin' }, (data) => renderDataPoint(data.datum, timezone))+ .with({ kind: 'event' }, (data) => renderEventPoint(data.event))+ .otherwise(() => null)}+ </IssueFilterPreviewHeader>+ )+}++function shouldRenderIssueMetrics(data: VolumeSparklineHoverSelection | null): boolean {+ return data == null+}++function IssueMetrics({+ aggregations,+ summaryLoading,+}: {+ aggregations: ErrorTrackingIssueAggregations | undefined+ summaryLoading: boolean+}): JSX.Element {+ const hasSessionCount = aggregations && aggregations.sessions !== 0+ return (+ <div className="flex h-full shrink-0 items-center gap-3">+ {renderMetric('Occurrences', aggregations?.occurrences, summaryLoading)}+ {renderMetric(+ 'Sessions',+ aggregations?.sessions,+ summaryLoading,+ hasSessionCount ? undefined : 'No $session_id was set for any event in this issue'+ )}+ {renderMetric('Users', aggregations?.users, summaryLoading)}+ </div>+ )+}++function renderMetric(name: string, value: number | undefined, loading: boolean, tooltip?: string): JSX.Element {+ return (+ <span className="contents">+ {loading && value == null ? (+ <Skeleton className="h-5 w-16">+ <span>Loading…</span>+ </Skeleton>+ ) : (+ <LemonTooltip title={tooltip} delayMs={0} placement="right">+ <div className="flex items-center gap-1">+ <div className="inline-block text-lg font-bold">+ {value == null ? '0' : humanFriendlyLargeNumber(value)}+ </div>+ <div className="inline-block text-xs text-muted-foreground">{name}</div>+ </div>+ </LemonTooltip>+ )}+ </span>+ )+}++function renderDataPoint(datum: SparklineDatum, timezone: string): JSX.Element {+ const timezoneLabel = shortTimeZone(timezone, datum.date)+ return (+ <div className="flex h-full shrink-0 items-center gap-3">+ {renderMetric('Occurrences', datum.value, false)}+ <div className="text-sm font-semibold">+ {dayjs(datum.date).tz(timezone).format('D MMM YYYY HH:mm')}+ {timezoneLabel ? ` (${timezoneLabel})` : ''}+ </div>+ {datum.isSpike && (+ <div className="flex items-center gap-1.5 text-warning-foreground">+ <IconTrending className="text-base" />+ <span className="text-xs font-semibold">Spike</span>+ <span className="text-xs text-muted-foreground">Click to view details</span>+ </div>+ )}+ </div>+ )+}++function renderEventPoint(event: SparklineEvent<string>): JSX.Element {+ return (+ <div className="flex h-full shrink-0 items-center justify-start">+ <div className="text-sm font-semibold">{dayjs(event.date).utc().format('D MMM YYYY HH:mm [UTC]')}</div>+ </div>+ )+}diff --git a/products/error_tracking/frontend/components/IssueFilterPreview/issueFilterPreviewLogic.test.ts b/products/error_tracking/frontend/components/IssueFilterPreview/issueFilterPreviewLogic.test.tsnew file mode 100644index 000000000000..4af33b3a4a8b--- /dev/null+++ b/products/error_tracking/frontend/components/IssueFilterPreview/issueFilterPreviewLogic.test.ts@@ -0,0 +1,123 @@+import { quickFiltersSectionLogic } from 'lib/components/QuickFilters'++import { QuickFilterContext } from '~/queries/schema/schema-general'+import { initKeaTests } from '~/test/init'+import { PropertyOperator } from '~/types'++import {+ DEFAULT_DATE_RANGE,+ DEFAULT_FILTER_GROUP,+ DEFAULT_SEARCH_QUERY,+ DEFAULT_TEST_ACCOUNT,+ ERROR_TRACKING_ISSUE_SCENE_LOGIC_KEY,+ issueFiltersLogic,+} from '../IssueFilters/issueFiltersLogic'+import { issueFilterPreviewLogic } from './issueFilterPreviewLogic'++describe('issueFilterPreviewLogic', () => {+ it('undoes preview filters step by step', () => {+ initKeaTests()+ const filters = issueFiltersLogic({ logicKey: ERROR_TRACKING_ISSUE_SCENE_LOGIC_KEY })+ const preview = issueFilterPreviewLogic()+ filters.mount()+ preview.mount()++ const firstDateRange = { date_from: '2024-01-01T00:00:00.000Z', date_to: '2024-01-01T02:00:00.000Z' }+ const secondDateRange = { date_from: '2024-01-01T00:00:00.000Z', date_to: '2024-01-01T01:00:00.000Z' }+ preview.actions.applyDateRangeFilter(firstDateRange)+ preview.actions.applyDateRangeFilter(secondDateRange)+ preview.actions.undoActivePreview()+ expect(filters.values.dateRange).toEqual(firstDateRange)+ expect(preview.values.canUndoActivePreview).toBe(true)+ preview.actions.undoActivePreview()+ expect(filters.values.dateRange).toEqual(DEFAULT_DATE_RANGE)+ expect(preview.values.canUndoActivePreview).toBe(false)++ preview.actions.setActivePreview('properties')+ preview.actions.applyPropertyFilter('$browser', 'Chrome')+ const firstFilterGroup = filters.values.filterGroup+ preview.actions.applyPropertyFilter('$browser', 'Chrome')+ expect(filters.values.filterGroup).toEqual(firstFilterGroup)+ expect(preview.values.filterGroupHistory).toHaveLength(1)+ preview.actions.applyPropertyFilter('$os', 'Mac OS X')+ preview.actions.undoActivePreview()+ expect(filters.values.filterGroup).toEqual(firstFilterGroup)+ preview.actions.undoActivePreview()+ expect(filters.values.filterGroup).toEqual(DEFAULT_FILTER_GROUP)++ preview.unmount()+ filters.unmount()+ })++ it('drops the undo stack when a filter changes manually after a preview', () => {+ initKeaTests()+ const filters = issueFiltersLogic({ logicKey: ERROR_TRACKING_ISSUE_SCENE_LOGIC_KEY })+ const preview = issueFilterPreviewLogic()+ filters.mount()+ preview.mount()++ // Time preview followed by a manual date change must not be undoable back to the pre-preview range.+ preview.actions.applyDateRangeFilter({+ date_from: '2024-01-01T00:00:00.000Z',+ date_to: '2024-01-01T01:00:00.000Z',+ })+ const manualDateRange = { date_from: '-30d', date_to: null }+ filters.actions.setDateRange(manualDateRange)+ expect(preview.values.dateRangeHistory).toEqual([])+ expect(preview.values.canUndoActivePreview).toBe(false)+ preview.actions.undoActivePreview()+ expect(filters.values.dateRange).toEqual(manualDateRange)++ // Property preview followed by a manual filter edit must not be undoable back to the pre-preview group.+ preview.actions.setActivePreview('properties')+ preview.actions.applyPropertyFilter('$browser', 'Chrome')+ const manualFilterGroup = filters.values.filterGroup+ filters.actions.setFilterGroup(manualFilterGroup)+ expect(preview.values.filterGroupHistory).toEqual([])+ expect(preview.values.canUndoActivePreview).toBe(false)+ preview.actions.undoActivePreview()+ expect(filters.values.filterGroup).toEqual(manualFilterGroup)++ preview.unmount()+ filters.unmount()+ })++ it('clears non-date filters without changing the date range', () => {+ initKeaTests()+ const filters = issueFiltersLogic({ logicKey: ERROR_TRACKING_ISSUE_SCENE_LOGIC_KEY })+ const quickFilters = quickFiltersSectionLogic({+ context: QuickFilterContext.ErrorTrackingIssueFilters,+ logicKey: ERROR_TRACKING_ISSUE_SCENE_LOGIC_KEY,+ })+ const preview = issueFilterPreviewLogic()+ filters.mount()+ quickFilters.mount()+ preview.mount()++ const dateRange = { date_from: '-30d', date_to: null }+ filters.actions.setDateRange(dateRange)+ preview.actions.applyPropertyFilter('$browser', 'Chrome')+ filters.actions.setFilterTestAccounts(true)+ filters.actions.setSearchQuery('checkout')+ quickFilters.actions.setQuickFilterValue('environment', '$environment', {+ id: 'production',+ label: 'Production',+ value: 'production',+ operator: PropertyOperator.Exact,+ })++ expect(preview.values.hasActiveFilters).toBe(true)+ preview.actions.clearNonDateFilters()++ expect(filters.values.dateRange).toEqual(dateRange)+ expect(filters.values.filterGroup).toEqual(DEFAULT_FILTER_GROUP)+ expect(filters.values.filterTestAccounts).toBe(DEFAULT_TEST_ACCOUNT)+ expect(filters.values.searchQuery).toBe(DEFAULT_SEARCH_QUERY)+ expect(quickFilters.values.selectedQuickFilters).toEqual({})+ expect(preview.values.hasActiveFilters).toBe(false)++ preview.unmount()+ quickFilters.unmount()+ filters.unmount()+ })+})diff --git a/products/error_tracking/frontend/components/IssueFilterPreview/issueFilterPreviewLogic.ts b/products/error_tracking/frontend/components/IssueFilterPreview/issueFilterPreviewLogic.tsnew file mode 100644index 000000000000..387ad0e41b85--- /dev/null+++ b/products/error_tracking/frontend/components/IssueFilterPreview/issueFilterPreviewLogic.ts@@ -0,0 +1,253 @@+import { MakeLogicType, actions, connect, kea, listeners, path, reducers, selectors } from 'kea'++import { SelectedQuickFilter, quickFiltersSectionLogic } from 'lib/components/QuickFilters'++import { DateRange, QuickFilterContext } from '~/queries/schema/schema-general'+import { PropertyOperator, UniversalFiltersGroup } from '~/types'++import {+ DEFAULT_FILTER_GROUP,+ DEFAULT_SEARCH_QUERY,+ DEFAULT_TEST_ACCOUNT,+ ERROR_TRACKING_ISSUE_SCENE_LOGIC_KEY,+ issueFiltersLogic,+} from '../IssueFilters/issueFiltersLogic'++export type IssueFilterPreview = 'time' | 'properties'++// Generated by kea-typegen. Update if you're an agent, ignore if you're human.+export interface issueFilterPreviewLogicValues {+ dateRange: DateRange // issueFiltersLogic+ filterGroup: UniversalFiltersGroup // issueFiltersLogic+ filterTestAccounts: boolean // issueFiltersLogic+ searchQuery: string // issueFiltersLogic+ selectedQuickFilters: Record<string, SelectedQuickFilter> // quickFiltersSectionLogic+ activePreview: IssueFilterPreview+ canUndoActivePreview: boolean+ dateRangeHistory: DateRange[]+ filterGroupHistory: UniversalFiltersGroup[]+ hasActiveFilters: boolean+}++// Generated by kea-typegen. Update if you're an agent, ignore if you're human.+export interface issueFilterPreviewLogicActions {+ addPropertyFilter: (+ key: string,+ value: boolean | number | string | null,+ operator?: PropertyOperator | undefined,+ openConfig?: boolean | undefined+ ) => {+ key: string+ openConfig: boolean+ operator: PropertyOperator+ value: boolean | number | string | null+ } // issueFiltersLogic+ setDateRange: (+ dateRange: DateRange,+ fromPreview?: boolean | undefined+ ) => {+ dateRange: DateRange+ fromPreview: boolean+ } // issueFiltersLogic+ setFilterGroup: (+ filterGroup: UniversalFiltersGroup,+ filterAddedFromPreview?: number | undefined+ ) => {+ filterAddedFromPreview: number+ filterGroup: UniversalFiltersGroup+ } // issueFiltersLogic+ setFilterTestAccounts: (filterTestAccounts: boolean) => {+ filterTestAccounts: boolean+ } // issueFiltersLogic+ setSearchQuery: (searchQuery: string) => {+ searchQuery: string+ } // issueFiltersLogic+ clearQuickFilter: (filterId: string) => {+ filterId: string+ } // quickFiltersSectionLogic+ applyDateRangeFilter: (dateRange: DateRange) => {+ dateRange: DateRange+ }+ applyPropertyFilter: (+ key: string,+ value: boolean | number | string | null,+ operator?: PropertyOperator+ ) => {+ key: string+ operator: PropertyOperator+ value: boolean | number | string | null+ }+ clearNonDateFilters: () => {+ value: true+ }+ popDateRangeHistory: () => {+ value: true+ }+ popFilterGroupHistory: () => {+ value: true+ }+ pushDateRangeHistory: (dateRange: DateRange) => {+ dateRange: DateRange+ }+ pushFilterGroupHistory: (filterGroup: UniversalFiltersGroup) => {+ filterGroup: UniversalFiltersGroup+ }+ setActivePreview: (activePreview: IssueFilterPreview) => {+ activePreview: IssueFilterPreview+ }+ undoActivePreview: () => {+ value: true+ }+}++// Generated by kea-typegen. Update if you're an agent, ignore if you're human.+export interface issueFilterPreviewLogicMeta {+ __keaTypeGenInternalSelectorTypes: {+ canUndoActivePreview: (+ activePreview: IssueFilterPreview,+ dateRangeHistory: DateRange[],+ filterGroupHistory: UniversalFiltersGroup[]+ ) => boolean+ hasActiveFilters: (+ filterGroup: UniversalFiltersGroup,+ filterTestAccounts: boolean,+ searchQuery: string,+ selectedQuickFilters: Record<string, SelectedQuickFilter>+ ) => boolean+ }+}++export type issueFilterPreviewLogicType = MakeLogicType<+ issueFilterPreviewLogicValues,+ issueFilterPreviewLogicActions,+ Record<string, any>,+ issueFilterPreviewLogicMeta+>++export const issueFilterPreviewLogic = kea<issueFilterPreviewLogicType>([+ path(['products', 'error_tracking', 'components', 'IssueFilterPreview', 'issueFilterPreviewLogic']),+ connect(() => ({+ values: [+ issueFiltersLogic({ logicKey: ERROR_TRACKING_ISSUE_SCENE_LOGIC_KEY }),+ ['dateRange', 'filterGroup', 'filterTestAccounts', 'searchQuery'],+ quickFiltersSectionLogic({+ context: QuickFilterContext.ErrorTrackingIssueFilters,+ logicKey: ERROR_TRACKING_ISSUE_SCENE_LOGIC_KEY,+ }),+ ['selectedQuickFilters'],+ ],+ actions: [+ issueFiltersLogic({ logicKey: ERROR_TRACKING_ISSUE_SCENE_LOGIC_KEY }),+ ['addPropertyFilter', 'setDateRange', 'setFilterGroup', 'setFilterTestAccounts', 'setSearchQuery'],+ quickFiltersSectionLogic({+ context: QuickFilterContext.ErrorTrackingIssueFilters,+ logicKey: ERROR_TRACKING_ISSUE_SCENE_LOGIC_KEY,+ }),+ ['clearQuickFilter'],+ ],+ })),+ actions({+ setActivePreview: (activePreview: IssueFilterPreview) => ({ activePreview }),+ applyDateRangeFilter: (dateRange: DateRange) => ({ dateRange }),+ applyPropertyFilter: (+ key: string,+ value: string | number | boolean | null,+ operator: PropertyOperator = PropertyOperator.Exact+ ) => ({ key, value, operator }),+ undoActivePreview: true,+ clearNonDateFilters: true,+ popDateRangeHistory: true,+ popFilterGroupHistory: true,+ pushDateRangeHistory: (dateRange: DateRange) => ({ dateRange }),+ pushFilterGroupHistory: (filterGroup: UniversalFiltersGroup) => ({ filterGroup }),+ }),+ reducers({+ activePreview: [+ 'time' as IssueFilterPreview,+ {+ setActivePreview: (_, { activePreview }) => activePreview,+ },+ ],+ dateRangeHistory: [+ [] as DateRange[],+ {+ pushDateRangeHistory: (history, { dateRange }) => [...history, dateRange],+ popDateRangeHistory: (history) => history.slice(0, -1),+ // A manual date change (not from a preview) invalidates the undo stack.+ setDateRange: (history, { fromPreview }) => (fromPreview ? history : []),+ },+ ],+ filterGroupHistory: [+ [] as UniversalFiltersGroup[],+ {+ pushFilterGroupHistory: (history, { filterGroup }) => [...history, filterGroup],+ popFilterGroupHistory: (history) => history.slice(0, -1),+ clearNonDateFilters: () => [],+ // A manual filter edit (not from a preview) invalidates the undo stack.+ setFilterGroup: (history, { filterAddedFromPreview }) => (filterAddedFromPreview ? history : []),+ },+ ],+ }),+ selectors({+ canUndoActivePreview: [+ (s) => [s.activePreview, s.dateRangeHistory, s.filterGroupHistory],+ (+ activePreview: IssueFilterPreview,+ dateRangeHistory: DateRange[],+ filterGroupHistory: UniversalFiltersGroup[]+ ): boolean => (activePreview === 'time' ? dateRangeHistory.length > 0 : filterGroupHistory.length > 0),+ ],+ hasActiveFilters: [+ (s) => [s.filterGroup, s.filterTestAccounts, s.searchQuery, s.selectedQuickFilters],+ (+ filterGroup: UniversalFiltersGroup,+ filterTestAccounts: boolean,+ searchQuery: string,+ selectedQuickFilters: Record<string, SelectedQuickFilter>+ ): boolean => {+ const firstValue = filterGroup.values[0]+ const hasPropertyFilters =+ firstValue !== undefined &&+ ('values' in firstValue ? firstValue.values.length > 0 : filterGroup.values.length > 0)+ return (+ hasPropertyFilters ||+ filterTestAccounts !== DEFAULT_TEST_ACCOUNT ||+ searchQuery !== DEFAULT_SEARCH_QUERY ||+ Object.keys(selectedQuickFilters).length > 0+ )+ },+ ],+ }),+ listeners(({ actions, values }) => ({+ applyDateRangeFilter: ({ dateRange }) => {+ actions.pushDateRangeHistory(values.dateRange)+ actions.setDateRange(dateRange, true)+ },+ applyPropertyFilter: ({ key, value, operator }) => {+ const previousFilterGroup = values.filterGroup+ actions.addPropertyFilter(key, value, operator, false)+ if (values.filterGroup !== previousFilterGroup) {+ actions.pushFilterGroupHistory(previousFilterGroup)+ }+ },+ undoActivePreview: () => {+ const previousDateRange = values.dateRangeHistory.at(-1)+ const previousFilterGroup = values.filterGroupHistory.at(-1)+ if (values.activePreview === 'time' && previousDateRange) {+ actions.setDateRange(previousDateRange, true)+ actions.popDateRangeHistory()+ } else if (values.activePreview === 'properties' && previousFilterGroup) {+ actions.setFilterGroup(previousFilterGroup, 1)+ actions.popFilterGroupHistory()+ }+ },+ clearNonDateFilters: () => {+ actions.setFilterGroup(DEFAULT_FILTER_GROUP)+ actions.setFilterTestAccounts(DEFAULT_TEST_ACCOUNT)+ actions.setSearchQuery(DEFAULT_SEARCH_QUERY)+ for (const filterId of Object.keys(values.selectedQuickFilters)) {+ actions.clearQuickFilter(filterId)+ }+ },+ })),+])diff --git a/products/error_tracking/frontend/components/IssueFilters/DateRange.test.tsx b/products/error_tracking/frontend/components/IssueFilters/DateRange.test.tsxindex 054e1f9f3273..be48571dc583 100644--- a/products/error_tracking/frontend/components/IssueFilters/DateRange.test.tsx+++ b/products/error_tracking/frontend/components/IssueFilters/DateRange.test.tsx@@ -7,7 +7,7 @@ import { BindLogic, Provider } from 'kea'import { useMocks } from '~/mocks/jest'import { initKeaTests } from '~/test/init'-import { DateRangeFilter } from './DateRange'+import { DateRangeFilter, getNextErrorTrackingDateRange } from './DateRange'import { issueFiltersLogic } from './issueFiltersLogic'const LOGIC_KEY = 'test'@@ -48,4 +48,22 @@ describe('DateRangeFilter', () => {logic.unmount()})++ it.each([+ [+ { date_from: '-1h', date_to: null },+ { dateRange: { date_from: '-24h', date_to: null }, label: '24 hours' },+ ],+ [+ { date_from: '-7d', date_to: null },+ { dateRange: { date_from: '-14d', date_to: null }, label: '14 days' },+ ],+ [+ { date_from: '-30d', date_to: null },+ { dateRange: { date_from: '-90d', date_to: null }, label: '90 days' },+ ],+ [{ date_from: '-180d', date_to: null }, null],+ ])('returns the next wider date tick for %j', (dateRange, expected) => {+ expect(getNextErrorTrackingDateRange(dateRange)).toEqual(expected)+ })})diff --git a/products/error_tracking/frontend/components/IssueFilters/DateRange.tsx b/products/error_tracking/frontend/components/IssueFilters/DateRange.tsxindex 3a6ecb23f9b3..1ad77291d070 100644--- a/products/error_tracking/frontend/components/IssueFilters/DateRange.tsx+++ b/products/error_tracking/frontend/components/IssueFilters/DateRange.tsx@@ -2,6 +2,8 @@ import { useActions, useValues } from 'kea'import { dateMapping } from 'lib/utils/dateFilters'+import { DateRange } from '~/queries/schema/schema-general'+import { DateRangeButton } from '../DateRangeButton'import { issueFiltersLogic } from './issueFiltersLogic'@@ -10,6 +12,31 @@ const ERROR_TRACKING_DATE_OPTIONS = dateMapping.filter((option) => !['Yesterday', 'All time', 'Today'].includes(option.key))+const ERROR_TRACKING_DATE_RANGE_TICKS = [+ { date_from: '-1h', label: '1 hour' },+ { date_from: '-24h', label: '24 hours' },+ { date_from: '-7d', label: '7 days' },+ { date_from: '-14d', label: '14 days' },+ { date_from: '-30d', label: '30 days' },+ { date_from: '-90d', label: '90 days' },+ { date_from: '-180d', label: '180 days' },+]++export function getNextErrorTrackingDateRange(dateRange: DateRange): { dateRange: DateRange; label: string } | null {+ const currentIndex = ERROR_TRACKING_DATE_RANGE_TICKS.findIndex(+ ({ date_from }) => dateRange.date_from === date_from && dateRange.date_to == null+ )+ if (currentIndex < 0 || currentIndex === ERROR_TRACKING_DATE_RANGE_TICKS.length - 1) {+ return null+ }++ const nextTick = ERROR_TRACKING_DATE_RANGE_TICKS[currentIndex + 1]+ return {+ dateRange: { date_from: nextTick.date_from, date_to: null },+ label: nextTick.label,+ }+}+export const DateRangeFilter = ({className,fullWidth = false,diff --git a/products/error_tracking/frontend/components/IssueFilters/FilterGroup.test.tsx b/products/error_tracking/frontend/components/IssueFilters/FilterGroup.test.tsxindex 49df703d8714..430f8acbfc33 100644--- a/products/error_tracking/frontend/components/IssueFilters/FilterGroup.test.tsx+++ b/products/error_tracking/frontend/components/IssueFilters/FilterGroup.test.tsx@@ -105,6 +105,53 @@ describe('FilterGroup', () => {logic.unmount()})+ it('renders the compact picker as an icon after active filters', () => {+ const logic = issueFiltersLogic({ logicKey: LOGIC_KEY })+ logic.mount()+ logic.actions.setFilterGroup({+ type: FilterLogicalOperator.And,+ values: [{ type: FilterLogicalOperator.And, values: [firefoxFilter] }],+ })++ render(+ <Provider>+ <BindLogic logic={issueFiltersLogic} props={{ logicKey: LOGIC_KEY }}>+ <FilterGroup activeFiltersInline iconOnly />+ </BindLogic>+ </Provider>+ )++ const filterPickerButton = screen.getByLabelText('Add filter')+ const activeFilters = screen.getByTestId('error-tracking-active-filters')++ expect(filterPickerButton).not.toHaveTextContent('Add filter')+ expect(+ activeFilters.compareDocumentPosition(filterPickerButton) & Node.DOCUMENT_POSITION_FOLLOWING+ ).toBeTruthy()++ logic.unmount()+ })++ it('does not open the filter config for a filter added from a preview', async () => {+ const logic = issueFiltersLogic({ logicKey: LOGIC_KEY })+ logic.mount()++ render(+ <Provider>+ <BindLogic logic={issueFiltersLogic} props={{ logicKey: LOGIC_KEY }}>+ <FilterGroup />+ </BindLogic>+ </Provider>+ )++ logic.actions.addPropertyFilter('$browser', 'Chrome', PropertyOperator.Exact, false)++ expect(await screen.findByText(/Chrome/)).toBeInTheDocument()+ expect(screen.queryByText('Choose filter')).not.toBeInTheDocument()++ logic.unmount()+ })+it('opens the filter picker directly to the main category', async () => {const logic = issueFiltersLogic({ logicKey: LOGIC_KEY })logic.mount()diff --git a/products/error_tracking/frontend/components/IssueFilters/FilterGroup.tsx b/products/error_tracking/frontend/components/IssueFilters/FilterGroup.tsxindex 33252932105d..0b9a1cafba49 100644--- a/products/error_tracking/frontend/components/IssueFilters/FilterGroup.tsx+++ b/products/error_tracking/frontend/components/IssueFilters/FilterGroup.tsx@@ -1,5 +1,6 @@import { useActions, useValues } from 'kea'import { useState } from 'react'+import type { ReactNode } from 'react'import { IconFilter } from '@posthog/icons'@@ -23,12 +24,16 @@ export const FilterGroup = ({taxonomicGroupTypes = TAXONOMIC_GROUP_TYPES,excludeFilterTypes,activeFiltersInline = false,+ iconOnly = false,+ renderControls,}: {taxonomicGroupTypes?: TaxonomicFilterGroupType[]excludeFilterTypes?: PropertyFilterType[]activeFiltersInline?: boolean+ iconOnly?: boolean+ renderControls?: (controls: { filterPicker: ReactNode; activeFilters: ReactNode }) => ReactNode} = {}): JSX.Element => {- const { filterGroup } = useValues(issueFiltersLogic)+ const { filterAddedFromPreview, filterGroup } = useValues(issueFiltersLogic)const { setFilterGroup } = useActions(issueFiltersLogic)const inner = filterGroup.values[0] as UniversalFiltersGroup@@ -44,7 +49,14 @@ export const FilterGroup = ({taxonomicGroupTypes={taxonomicGroupTypes}onChange={(group) => setFilterGroup({ type: FilterLogicalOperator.And, values: [group] })}>- <FilterControls taxonomicGroupTypes={taxonomicGroupTypes} activeFiltersInline={activeFiltersInline} />+ <FilterControls+ taxonomicGroupTypes={taxonomicGroupTypes}+ activeFiltersInline={activeFiltersInline}+ iconOnly={iconOnly}+ filterAddedFromPreview={filterAddedFromPreview}+ renderControls={renderControls}+ hasActiveFilters={displayGroup.values.length > 0}+ /></UniversalFilters>)}@@ -53,15 +65,23 @@ const FilterControls = ({taxonomicGroupTypes = TAXONOMIC_GROUP_TYPES,nested = false,activeFiltersInline = false,+ iconOnly = false,+ filterAddedFromPreview = 0,+ renderControls,+ hasActiveFilters = false,}: {taxonomicGroupTypes?: TaxonomicFilterGroupType[]nested?: booleanactiveFiltersInline?: boolean+ iconOnly?: boolean+ filterAddedFromPreview?: number+ renderControls?: (controls: { filterPicker: ReactNode; activeFilters: ReactNode }) => ReactNode+ hasActiveFilters?: boolean}): JSX.Element => {const filterRow = (<div className={`relative flex shrink-0 items-center ${activeFiltersInline ? 'gap-2' : 'gap-1'}`}>{nested ? <FilterOperatorToggle /> : null}- <FilterPicker taxonomicGroupTypes={taxonomicGroupTypes} />+ <FilterPicker taxonomicGroupTypes={taxonomicGroupTypes} iconOnly={iconOnly} />{nested ? null : <FilterOperatorToggle />}</div>)@@ -75,11 +95,49 @@ const FilterControls = ({)}+ if (renderControls) {+ return (+ <>+ {renderControls({+ filterPicker: (+ <div className="relative flex shrink-0 items-center">+ <FilterPicker taxonomicGroupTypes={taxonomicGroupTypes} iconOnly={iconOnly} />+ </div>+ ),+ activeFilters: hasActiveFilters ? (+ <UniversalFilterGroup+ taxonomicGroupTypes={taxonomicGroupTypes}+ filterAddedFromPreview={filterAddedFromPreview}+ prefix={<FilterOperatorToggle />}+ className="flex w-full flex-wrap items-center gap-1"+ dataAttr="error-tracking-active-filters"+ />+ ) : null,+ })}+ </>+ )+ }++ if (activeFiltersInline && iconOnly) {+ return (+ <>+ <UniversalFilterGroup+ taxonomicGroupTypes={taxonomicGroupTypes}+ filterAddedFromPreview={filterAddedFromPreview}+ className="flex min-w-0 flex-nowrap items-center gap-1 overflow-hidden"+ dataAttr="error-tracking-active-filters"+ />+ {filterRow}+ </>+ )+ }+return (<>{filterRow}<UniversalFilterGrouptaxonomicGroupTypes={taxonomicGroupTypes}+ filterAddedFromPreview={filterAddedFromPreview}className={activeFiltersInline? 'flex flex-1 flex-wrap items-center gap-2'@@ -91,7 +149,13 @@ const FilterControls = ({)}-const FilterPicker = ({ taxonomicGroupTypes }: { taxonomicGroupTypes: TaxonomicFilterGroupType[] }): JSX.Element => {+const FilterPicker = ({+ taxonomicGroupTypes,+ iconOnly,+}: {+ taxonomicGroupTypes: TaxonomicFilterGroupType[]+ iconOnly: boolean+}): JSX.Element => {const { addGroupFilter } = useActions(universalFiltersLogic)const [openRequest, setOpenRequest] = useState(0)@@ -110,8 +174,10 @@ const FilterPicker = ({ taxonomicGroupTypes }: { taxonomicGroupTypes: TaxonomicFdefaultOpenState="combobox"trigger={({ open }) => (<Button- variant="outline"- size="default"+ variant={iconOnly ? 'default' : 'outline'}+ size={iconOnly ? 'icon-sm' : 'default'}+ aria-label={iconOnly ? 'Add filter' : undefined}+ title={iconOnly ? 'Add filter' : undefined}aria-expanded={open}onClick={() => {if (!open) {@@ -120,7 +186,7 @@ const FilterPicker = ({ taxonomicGroupTypes }: { taxonomicGroupTypes: TaxonomicF}}><IconFilter />- Add filter+ {!iconOnly && 'Add filter'}</Button>)}/>@@ -153,7 +219,7 @@ const FilterOperatorToggle = (): JSX.Element | null => {return (<ToggleGroupvariant="outline"- size="default"+ size="sm"className="shrink-0"value={[filterGroup.type]}onValueChange={([type]) => {@@ -175,10 +241,14 @@ const UniversalFilterGroup = ({taxonomicGroupTypes = TAXONOMIC_GROUP_TYPES,className,dataAttr,+ prefix,+ filterAddedFromPreview = 0,}: {taxonomicGroupTypes?: TaxonomicFilterGroupType[]className?: stringdataAttr?: string+ prefix?: ReactNode+ filterAddedFromPreview?: number}): JSX.Element | null => {const { filterGroup } = useValues(universalFiltersLogic)const { replaceGroupValue, removeGroupValue } = useActions(universalFiltersLogic)@@ -202,16 +272,24 @@ const UniversalFilterGroup = ({filter={filterOrGroup}onRemove={() => removeGroupValue(index)}onChange={(value) => replaceGroupValue(index, value)}- initiallyOpen={allowInitiallyOpen && filterOrGroup.type != PropertyFilterType.HogQL}+ initiallyOpen={+ allowInitiallyOpen &&+ filterOrGroup.type != PropertyFilterType.HogQL &&+ index < filterGroup.values.length - filterAddedFromPreview+ }/>)})return className ? (<div className={className} data-attr={dataAttr}>+ {prefix}{values}</div>) : (- <>{values}</>+ <>+ {prefix}+ {values}+ </>)}diff --git a/products/error_tracking/frontend/components/IssueFilters/Search.tsx b/products/error_tracking/frontend/components/IssueFilters/Search.tsxindex 063fb1dfaaf4..b0b5c5291470 100644--- a/products/error_tracking/frontend/components/IssueFilters/Search.tsx+++ b/products/error_tracking/frontend/components/IssueFilters/Search.tsx@@ -1,5 +1,5 @@import { useActions, useValues } from 'kea'-import type { ChangeEvent } from 'react'+import type { ChangeEvent, ReactNode } from 'react'import { IconSearch } from '@posthog/icons'@@ -11,9 +11,11 @@ import { issueFiltersLogic } from './issueFiltersLogic'export function IssueSearchInput({className,placeholder = 'Search issues',+ endAddon,}: {className?: stringplaceholder?: string+ endAddon?: ReactNode}): JSX.Element {const { searchInput } = useValues(issueFiltersLogic)const { setSearchInput } = useActions(issueFiltersLogic)@@ -31,6 +33,11 @@ export function IssueSearchInput({placeholder={placeholder}aria-label={placeholder}/>+ {endAddon && (+ <InputGroupAddon align="inline-end" className="min-w-0 gap-1 px-1 py-0">+ {endAddon}+ </InputGroupAddon>+ )}</InputGroup></div>)diff --git a/products/error_tracking/frontend/components/IssueFilters/issueFiltersLogic.test.ts b/products/error_tracking/frontend/components/IssueFilters/issueFiltersLogic.test.tsindex 56f995bc77f0..94bb84765056 100644--- a/products/error_tracking/frontend/components/IssueFilters/issueFiltersLogic.test.ts+++ b/products/error_tracking/frontend/components/IssueFilters/issueFiltersLogic.test.ts@@ -68,6 +68,68 @@ describe('issueFiltersLogic', () => {expect(logic.values.searchInput).toBe('from-url')})+ describe('addPropertyFilter', () => {+ test.each([+ {+ name: 'an exact value',+ value: 'Chrome',+ operator: PropertyOperator.Exact,+ expectedValue: ['Chrome'],+ },+ {+ name: 'a missing value',+ value: null,+ operator: PropertyOperator.IsNotSet,+ expectedValue: undefined,+ },+ ])('appends $name without replacing existing filters', async ({ value, operator, expectedValue }) => {+ const existingFilter: EventPropertyFilter = {+ type: PropertyFilterType.Event,+ key: '$os',+ operator: PropertyOperator.Exact,+ value: ['Linux'],+ }+ logic.actions.setFilterGroup({+ type: FilterLogicalOperator.And,+ values: [{ type: FilterLogicalOperator.And, values: [existingFilter] }],+ })++ await expectLogic(logic, () => {+ logic.actions.addPropertyFilter('$browser', value, operator)+ })+ .toDispatchActions(['addPropertyFilter', 'setFilterGroup'])+ .toFinishAllListeners()++ const innerGroup = logic.values.filterGroup.values[0] as UniversalFiltersGroup+ expect(innerGroup.values).toEqual([+ existingFilter,+ {+ type: PropertyFilterType.Event,+ key: '$browser',+ operator,+ ...(expectedValue === undefined ? {} : { value: expectedValue }),+ },+ ])+ })++ it('does not add an identical filter twice', async () => {+ await expectLogic(logic, () => {+ logic.actions.addPropertyFilter('$browser', 'Chrome')+ logic.actions.addPropertyFilter('$browser', 'Chrome')+ }).toFinishAllListeners()++ const innerGroup = logic.values.filterGroup.values[0] as UniversalFiltersGroup+ expect(innerGroup.values).toEqual([+ {+ type: PropertyFilterType.Event,+ key: '$browser',+ operator: PropertyOperator.Exact,+ value: ['Chrome'],+ },+ ])+ })+ })+describe('mergedFilterGroup', () => {const propA: EventPropertyFilter = {type: PropertyFilterType.Event,diff --git a/products/error_tracking/frontend/components/IssueFilters/issueFiltersLogic.ts b/products/error_tracking/frontend/components/IssueFilters/issueFiltersLogic.tsindex cedb49af0fda..e88d5e7757f7 100644--- a/products/error_tracking/frontend/components/IssueFilters/issueFiltersLogic.ts+++ b/products/error_tracking/frontend/components/IssueFilters/issueFiltersLogic.ts@@ -6,17 +6,25 @@ import { isUniversalGroupFilterLike } from 'lib/components/UniversalFilters/utilimport { Params } from 'scenes/sceneTypes'import { DateRange, QuickFilterContext } from '~/queries/schema/schema-general'-import { FilterLogicalOperator, PropertyFilterType, UniversalFiltersGroup } from '~/types'+import {+ EventPropertyFilter,+ FilterLogicalOperator,+ PropertyFilterType,+ PropertyOperator,+ UniversalFiltersGroup,+} from '~/types'import { updateSearchParams } from '../../utils'+export const ERROR_TRACKING_ISSUE_SCENE_LOGIC_KEY = 'ErrorTrackingIssueScene'+export const DEFAULT_DATE_RANGE = { date_from: '-7d', date_to: null }export const DEFAULT_FILTER_GROUP = {type: FilterLogicalOperator.And,values: [{ type: FilterLogicalOperator.And, values: [] }],}export const DEFAULT_TEST_ACCOUNT = false-const DEFAULT_SEARCH_QUERY = ''+export const DEFAULT_SEARCH_QUERY = ''export interface IssueFiltersLogicProps {logicKey: string@@ -26,6 +34,7 @@ export interface IssueFiltersLogicProps {export interface issueFiltersLogicValues {selectedQuickFilters: Record<string, SelectedQuickFilter> // quickFiltersSectionLogicdateRange: DateRange+ filterAddedFromPreview: numberfilterGroup: UniversalFiltersGroupfilterTestAccounts: booleanmergedFilterGroup: UniversalFiltersGroup@@ -35,10 +44,29 @@ export interface issueFiltersLogicValues {// Generated by kea-typegen. Update if you're an agent, ignore if you're human.export interface issueFiltersLogicActions {- setDateRange: (dateRange: DateRange) => {+ addPropertyFilter: (+ key: string,+ value: boolean | number | string | null,+ operator?: PropertyOperator,+ openConfig?: boolean+ ) => {+ key: string+ openConfig: boolean+ operator: PropertyOperator+ value: boolean | number | string | null+ }+ setDateRange: (+ dateRange: DateRange,+ fromPreview?: boolean+ ) => {dateRange: DateRange+ fromPreview: boolean}- setFilterGroup: (filterGroup: UniversalFiltersGroup) => {+ setFilterGroup: (+ filterGroup: UniversalFiltersGroup,+ filterAddedFromPreview?: number+ ) => {+ filterAddedFromPreview: numberfilterGroup: UniversalFiltersGroup}setFilterTestAccounts: (filterTestAccounts: boolean) => {@@ -86,10 +114,19 @@ export const issueFiltersLogic = kea<issueFiltersLogicType>([})),actions({- setDateRange: (dateRange: DateRange) => ({ dateRange }),+ addPropertyFilter: (+ key: string,+ value: string | number | boolean | null,+ operator: PropertyOperator = PropertyOperator.Exact,+ openConfig: boolean = true+ ) => ({ key, value, operator, openConfig }),+ setDateRange: (dateRange: DateRange, fromPreview: boolean = false) => ({ dateRange, fromPreview }),setSearchInput: (searchInput: string) => ({ searchInput }),setSearchQuery: (searchQuery: string) => ({ searchQuery }),- setFilterGroup: (filterGroup: UniversalFiltersGroup) => ({ filterGroup }),+ setFilterGroup: (filterGroup: UniversalFiltersGroup, filterAddedFromPreview: number = 0) => ({+ filterGroup,+ filterAddedFromPreview,+ }),setFilterTestAccounts: (filterTestAccounts: boolean) => ({ filterTestAccounts }),}),reducers({@@ -102,10 +139,43 @@ export const issueFiltersLogic = kea<issueFiltersLogicType>([filterGroup: [DEFAULT_FILTER_GROUP as UniversalFiltersGroup,{+ addPropertyFilter: (filterGroup, { key, value, operator }) => {+ const firstValue = filterGroup.values[0]+ const firstGroup: UniversalFiltersGroup = isUniversalGroupFilterLike(firstValue)+ ? firstValue+ : {+ type: FilterLogicalOperator.And,+ values: firstValue ? [firstValue] : [],+ }+ const newFilter: EventPropertyFilter = {+ key,+ type: PropertyFilterType.Event,+ operator,+ ...(value === null ? {} : { value: [value] }),+ }+ if (firstGroup.values.some((existingFilter) => equal(existingFilter, newFilter))) {+ return filterGroup+ }++ return {+ type: FilterLogicalOperator.And,+ values: [+ { ...firstGroup, values: [...firstGroup.values, newFilter] },+ ...filterGroup.values.slice(1),+ ],+ }+ },setFilterGroup: (_, { filterGroup }) =>filterGroup?.values?.length ? filterGroup : DEFAULT_FILTER_GROUP,},],+ filterAddedFromPreview: [+ 0,+ {+ setFilterGroup: (_, { filterAddedFromPreview }) => filterAddedFromPreview,+ addPropertyFilter: (_, { openConfig }) => (openConfig ? 0 : 1),+ },+ ],filterTestAccounts: [DEFAULT_TEST_ACCOUNT as boolean,{@@ -127,6 +197,9 @@ export const issueFiltersLogic = kea<issueFiltersLogicType>([],}),listeners(({ actions, values }) => ({+ addPropertyFilter: ({ openConfig }) => {+ actions.setFilterGroup(values.filterGroup, openConfig ? 0 : 1)+ },setSearchInput: async ({ searchInput }, breakpoint) => {await breakpoint(250)if (values.searchInput === searchInput) {diff --git a/products/error_tracking/frontend/components/IssueMetadata.tsx b/products/error_tracking/frontend/components/IssueMetadata.tsxdeleted file mode 100644index 6da482addb5a..000000000000--- a/products/error_tracking/frontend/components/IssueMetadata.tsx+++ /dev/null@@ -1,249 +0,0 @@-import { useActions, useValues } from 'kea'-import { PropsWithChildren, UIEvent, useCallback, useMemo, useRef } from 'react'-import { match } from 'ts-pattern'--import { IconChevronRight, IconTrending } from '@posthog/icons'-import { Tooltip } from '@posthog/lemon-ui'--import { ErrorTrackingSpikeEvent } from 'lib/components/Errors/types'-import { dayjs } from 'lib/dayjs'-import { Skeleton } from 'lib/ui/quill'-import { humanFriendlyLargeNumber } from 'lib/utils/numbers'--import { ErrorTrackingIssueAggregations } from '~/queries/schema/schema-general'--import { useSparklineDataIssueScene } from '../hooks/use-sparkline-data'-import { useSparklineEvents } from '../hooks/use-sparkline-events'-import { errorTrackingIssueSceneLogic } from '../scenes/ErrorTrackingIssueScene/errorTrackingIssueSceneLogic'-import { cancelEvent } from '../utils'-import { SpikeDetailsPopover } from './SpikeDetailsPopover'-import { TimeBoundary } from './TimeBoundary'-import { errorTrackingVolumeSparklineLogic } from './VolumeSparkline/errorTrackingVolumeSparklineLogic'-import type { SparklineDatum, SparklineEvent, VolumeSparklineHoverSelection } from './VolumeSparkline/types'-import { VolumeSparkline } from './VolumeSparkline/VolumeSparkline'--export const Metadata = ({- children,- className,- onScrollNearEnd,-}: PropsWithChildren<{ className?: string; onScrollNearEnd?: () => void }>): JSX.Element => {- const { issueId, spikeEvents } = useValues(errorTrackingIssueSceneLogic)- const { setDateRange } = useActions(errorTrackingIssueSceneLogic)- const sparklineKey = issueId || 'issue-unknown'- const { clickedSpike } = useValues(errorTrackingVolumeSparklineLogic({ sparklineKey }))- const { setClickedSpike } = useActions(errorTrackingVolumeSparklineLogic({ sparklineKey }))- const sparklineData = useSparklineDataIssueScene()- const sparklineEvents = useSparklineEvents()- const sparklineContainerRef = useRef<HTMLDivElement | null>(null)-- const handleRangeSelect = useCallback(- (startDate: Date, endDate: Date) => {- setClickedSpike(null)- setDateRange({- date_from: startDate.toISOString(),- date_to: endDate.toISOString(),- })- },- [setDateRange, setClickedSpike]- )-- const handleSpikeClick = useCallback(- (datum: SparklineDatum, clientX: number, clientY: number) => {- setClickedSpike({ datum, clientX, clientY })- },- [setClickedSpike]- )-- const handleScroll = (event: UIEvent<HTMLDivElement>): void => {- const { clientHeight, scrollHeight, scrollTop } = event.currentTarget- if (scrollHeight - scrollTop - clientHeight <= 400) {- onScrollNearEnd?.()- }- }-- const matchedSpikeEvent = useMemo<ErrorTrackingSpikeEvent | null>(() => {- if (!clickedSpike || sparklineData.length < 2) {- return null- }- const binSizeMs = sparklineData[1].date.getTime() - sparklineData[0].date.getTime()- const binStart = clickedSpike.datum.date.getTime()- return (- (spikeEvents as ErrorTrackingSpikeEvent[]).find((s) => {- const t = new Date(s.detected_at).getTime()- return t >= binStart && t < binStart + binSizeMs- }) ?? null- )- }, [clickedSpike, spikeEvents, sparklineData])-- return (- <div className={className}>- <MetadataHeader sparklineKey={sparklineKey} />- <div- onClick={cancelEvent}- ref={sparklineContainerRef}- className="relative w-full min-h-[160px] shrink-0 flex flex-col px-4"- >- <VolumeSparkline- data={sparklineData}- layout="detailed"- xAxis="full"- events={sparklineEvents}- sparklineKey={sparklineKey}- className="h-full min-h-[160px]"- onRangeSelect={handleRangeSelect}- onSpikeClick={handleSpikeClick}- />- </div>- {clickedSpike && (- <SpikeDetailsPopover- datum={clickedSpike.datum}- clientX={clickedSpike.clientX}- clientY={clickedSpike.clientY}- spikeEvent={matchedSpikeEvent}- onClose={() => setClickedSpike(null)}- sparklineContainerRef={sparklineContainerRef}- />- )}- <div className="flex-1 min-h-0 overflow-y-auto [scrollbar-gutter:stable]" onScroll={handleScroll}>- {children}- </div>- </div>- )-}--/** Owns the `hoverSelection` read: it changes on every hovered bucket, and reading it in- * `Metadata` would re-render the whole chart subtree per mousemove. */-function MetadataHeader({ sparklineKey }: { sparklineKey: string }): JSX.Element {- const { aggregations, summaryLoading, issueLoading, firstSeen, lastSeen } = useValues(errorTrackingIssueSceneLogic)- const { hoverSelection } = useValues(errorTrackingVolumeSparklineLogic({ sparklineKey }))-- return (- <div className="flex justify-between items-center h-[40px] px-4 shrink-0">- <div className="flex justify-end items-center h-full">- {match(hoverSelection)- .when(- (data) => shouldRenderIssueMetrics(data),- () => <IssueMetrics aggregations={aggregations} summaryLoading={summaryLoading} />- )- .with({ kind: 'bin' }, (data) => renderDataPoint(data.datum))- .with({ kind: 'event' }, (data) => renderEventPoint(data.event))- .otherwise(() => null)}- </div>- <div className="flex justify-end items-center h-full">- {match(hoverSelection)- .with({ kind: 'bin' }, (data) => renderDate(data.datum.date))- .with({ kind: 'event' }, (data) => renderDate(data.event.date))- .otherwise(() => (- <>- <TimeBoundary- time={firstSeen}- loading={issueLoading}- label="First Seen"- updateDateRange={(dateRange) => {- dateRange.date_from = firstSeen?.toISOString()- return dateRange- }}- />- <IconChevronRight />- <TimeBoundary- time={lastSeen}- loading={summaryLoading}- label="Last Seen"- updateDateRange={(dateRange) => {- dateRange.date_to = lastSeen?.endOf('minute').toISOString()- return dateRange- }}- />- </>- ))}- </div>- </div>- )-}--function shouldRenderIssueMetrics(data: VolumeSparklineHoverSelection | null): boolean {- if (data == null) {- return true- }- if (data.kind === 'bin' && data.datum.value == 0) {- return true- }- return false-}--function IssueMetrics({- aggregations,- summaryLoading,-}: {- aggregations: ErrorTrackingIssueAggregations | undefined- summaryLoading: boolean-}): JSX.Element {- const hasSessionCount = aggregations && aggregations.sessions !== 0- return (- <div className="flex items-center h-full gap-3">- {renderMetric('Occurrences', aggregations?.occurrences, summaryLoading)}- {renderMetric(- 'Sessions',- aggregations?.sessions,- summaryLoading,- hasSessionCount ? undefined : 'No $session_id was set for any event in this issue'- )}- {renderMetric('Users', aggregations?.users, summaryLoading)}- </div>- )-}--function renderMetric(name: string, value: number | undefined, loading: boolean, tooltip?: string): JSX.Element {- return (- <span className="contents">- {match([loading])- .with([true], () => (- <Skeleton className="h-2 w-[50px]">- <span>Loading…</span>- </Skeleton>- ))- .with([false], () => (- <Tooltip title={tooltip} delayMs={0} placement="right">- <div className="flex items-center gap-1">- <div className="text-lg font-bold inline-block">- {value == null ? '0' : humanFriendlyLargeNumber(value)}- </div>- <div className="inline-block text-xs text-muted-foreground">{name}</div>- </div>- </Tooltip>- ))- .exhaustive()}- </span>- )-}--function renderDate(date: Date): JSX.Element {- return (- <div className="whitespace-nowrap text-xs text-muted-foreground">- {dayjs(date).utc().format('D MMM YYYY HH:mm (UTC)')}- </div>- )-}--function renderDataPoint(d: SparklineDatum): JSX.Element {- return (- <div className="flex items-center h-full gap-3">- {renderMetric('Occurrences', d.value, false)}- {d.isSpike && (- <div className="flex items-center gap-1.5 text-warning-foreground">- <IconTrending className="text-base" />- <span className="text-xs font-semibold">Spike</span>- <span className="text-xs text-muted-foreground">— click to see details</span>- </div>- )}- </div>- )-}--function renderEventPoint(d: SparklineEvent<string>): JSX.Element {- return (- <div className="flex justify-start items-center h-full gap-1">- <div className="text-lg font-bold">{d.payload}</div>- </div>- )-}diff --git a/products/error_tracking/frontend/components/VolumeSparkline/EventMarkers.tsx b/products/error_tracking/frontend/components/VolumeSparkline/EventMarkers.tsxindex 5bdd15e1fe4e..bcf70e528085 100644--- a/products/error_tracking/frontend/components/VolumeSparkline/EventMarkers.tsx+++ b/products/error_tracking/frontend/components/VolumeSparkline/EventMarkers.tsx@@ -151,7 +151,7 @@ export const EventMarkers = memo(function EventMarkers({labelRefs.current[index] = node}}data-attr="error-tracking-volume-event-label"- className="absolute flex items-center px-[5px] rounded text-[10px] font-semibold text-white whitespace-nowrap cursor-default"+ className="absolute flex items-center px-2 rounded text-[10px] font-semibold text-white whitespace-nowrap cursor-default"// eslint-disable-next-line react/forbid-dom-propsstyle={{top: labelTop,diff --git a/products/error_tracking/frontend/components/VolumeSparkline/VolumeSparkline.test.tsx b/products/error_tracking/frontend/components/VolumeSparkline/VolumeSparkline.test.tsxindex 493b43c54781..44d967e7ba7e 100644--- a/products/error_tracking/frontend/components/VolumeSparkline/VolumeSparkline.test.tsx+++ b/products/error_tracking/frontend/components/VolumeSparkline/VolumeSparkline.test.tsx@@ -86,6 +86,20 @@ describe('VolumeSparkline', () => {})})+ describe('bucket clicks', () => {+ it('selects the clicked bucket using its start and end boundaries', () => {+ const onRangeSelect = jest.fn()+ const data = buildData({ 3: { date: new Date('2024-01-01T04:00:00.000Z') } })+ const wrapper = renderChart({ data, onBucketClick: onRangeSelect })++ hoverAtIndex(wrapper, 2, data.length)+ fireEvent.click(wrapper)++ expect(onRangeSelect).toHaveBeenCalledWith(data[2].date, data[3].date)+ expect(wrapper.classList.contains('cursor-pointer')).toBe(true)+ })+ })+describe('spike clicks', () => {it('fires onSpikeClick with the viewport cursor position when a flagged bucket is clicked', () => {const onSpikeClick = jest.fn()@@ -111,6 +125,31 @@ describe('VolumeSparkline', () => {expect(onSpikeClick).toHaveBeenCalledWith(data[2], 123, 45)})+ it('prefers onSpikeClick over onBucketClick when a flagged bucket is clicked', () => {+ const onBucketClick = jest.fn()+ const onSpikeClick = jest.fn()+ const data = buildData({ 2: { isSpike: true, color: 'var(--brand-red)' } })+ const { container } = render(+ <VolumeSparkline+ sparklineKey={SPARKLINE_KEY}+ data={data}+ layout="detailed"+ xAxis="full"+ onBucketClick={onBucketClick}+ onSpikeClick={onSpikeClick}+ />+ )+ const wrapper = getHogChart(container).element++ hoverAtIndex(wrapper, 2, data.length)+ fireEvent.mouseMove(container.firstElementChild as HTMLElement, { clientX: 123, clientY: 45 })+ fireEvent.click(wrapper)++ expect(onSpikeClick).toHaveBeenCalledTimes(1)+ expect(onSpikeClick).toHaveBeenCalledWith(data[2], 123, 45)+ expect(onBucketClick).not.toHaveBeenCalled()+ })+it('does not fire onSpikeClick for an ordinary (non-spike) bucket', () => {const onSpikeClick = jest.fn()// A spike elsewhere enables the handler (`hasSpikes`); the click lands on andiff --git a/products/error_tracking/frontend/components/VolumeSparkline/VolumeSparkline.tsx b/products/error_tracking/frontend/components/VolumeSparkline/VolumeSparkline.tsxindex eb9ccc6831ff..09569b0e9572 100644--- a/products/error_tracking/frontend/components/VolumeSparkline/VolumeSparkline.tsx+++ b/products/error_tracking/frontend/components/VolumeSparkline/VolumeSparkline.tsx@@ -58,6 +58,7 @@ export type VolumeSparklineProps = {className?: stringevents?: SparklineEvent<string>[]onRangeSelect?: (startDate: Date, endDate: Date) => void+ onBucketClick?: (startDate: Date, endDate: Date) => voidonSpikeClick?: (datum: SparklineDatum, clientX: number, clientY: number) => void}@@ -69,6 +70,7 @@ export function VolumeSparkline({className,events = [],onRangeSelect,+ onBucketClick,onSpikeClick,}: VolumeSparklineProps): JSX.Element {const theme = useChartTheme()@@ -150,22 +152,33 @@ export function VolumeSparkline({}}, [data, onRangeSelect])- // Only wired when a spike exists: `onPointClick` sets a pointer cursor chart-wide, which- // would mask the drag-select crosshair.const hasSpikes = useMemo(() => data.some((datum) => datum.isSpike), [data])- const onPointClick = useMemo(- () =>- onSpikeClick && hasSpikes- ? ({ dataIndex }: PointClickData) => {- const datum = data[dataIndex]- if (datum?.isSpike) {- onSpikeClick(datum, cursorRef.current.x, cursorRef.current.y)- }- }- : undefined,- [data, hasSpikes, onSpikeClick]- )+ const onPointClick = useMemo(() => {+ if (!onBucketClick && !(onSpikeClick && hasSpikes)) {+ return undefined+ }+ return ({ dataIndex }: PointClickData) => {+ const datum = data[dataIndex]+ if (!datum) {+ return+ }+ const adjacentDate = data[dataIndex + 1]?.date+ const previousDate = data[dataIndex - 1]?.date+ const endDate =+ adjacentDate ??+ (previousDate ? new Date(datum.date.getTime() + datum.date.getTime() - previousDate.getTime()) : null)+ // A flagged spike takes precedence: it opens the spike details popover rather than+ // filtering to the bucket, so callers passing both handlers still reach the popover.+ if (datum.isSpike && onSpikeClick) {+ onSpikeClick(datum, cursorRef.current.x, cursorRef.current.y)+ return+ }+ if (onBucketClick && endDate && endDate.getTime() > datum.date.getTime()) {+ onBucketClick(datum.date, endDate)+ }+ }+ }, [data, hasSpikes, onBucketClick, onSpikeClick])return (<divdiff --git a/products/error_tracking/frontend/hooks/use-sparkline-events.tsx b/products/error_tracking/frontend/hooks/use-sparkline-events.tsxindex 62172c4f715a..79440c8059d2 100644--- a/products/error_tracking/frontend/hooks/use-sparkline-events.tsx+++ b/products/error_tracking/frontend/hooks/use-sparkline-events.tsx@@ -11,13 +11,13 @@ export function useSparklineEvents(): SparklineEvent<string>[] {const { firstSeen, lastSeen, selectedEvent } = useValues(errorTrackingIssueSceneLogic)return useMemo(() => {- const events = []+ const events: SparklineEvent<string>[] = []if (firstSeen) {events.push({id: 'first_seen',date: firstSeen.toDate(),color: 'var(--brand-blue)',- payload: 'First Seen',+ payload: 'First seen',})}if (selectedEvent && !isFirstOrLastEvent(firstSeen, lastSeen, selectedEvent)) {@@ -33,7 +33,7 @@ export function useSparklineEvents(): SparklineEvent<string>[] {id: 'last_seen',date: lastSeen.toDate(),color: 'var(--brand-red)',- payload: 'Last Seen',+ payload: 'Last seen',})}return events@@ -45,11 +45,7 @@ function isFirstOrLastEvent(lastSeen: Dayjs | null,selectedEvent: ErrorEventType | null): boolean {- if (selectedEvent && firstSeen?.isSame(selectedEvent.timestamp)) {- return true- }- if (selectedEvent && lastSeen?.isSame(selectedEvent.timestamp)) {- return true- }- return false+ return Boolean(+ selectedEvent && (firstSeen?.isSame(selectedEvent.timestamp) || lastSeen?.isSame(selectedEvent.timestamp))+ )}diff --git a/products/error_tracking/frontend/scenes/ErrorTrackingIssueScene/ErrorTrackingIssueScene.tsx b/products/error_tracking/frontend/scenes/ErrorTrackingIssueScene/ErrorTrackingIssueScene.tsxindex 9a9dc29571fe..ab2710247526 100644--- a/products/error_tracking/frontend/scenes/ErrorTrackingIssueScene/ErrorTrackingIssueScene.tsx+++ b/products/error_tracking/frontend/scenes/ErrorTrackingIssueScene/ErrorTrackingIssueScene.tsx@@ -1,27 +1,20 @@import '../ErrorTrackingIssueScene/ErrorTrackingIssueScene.scss'import clsx from 'clsx'-import { BindLogic, useActions, useMountedLogic, useValues } from 'kea'+import { BindLogic, useActions, useValues } from 'kea'import posthog from 'posthog-js'import { useEffect, useRef } from 'react'-import { IconFilter, IconList, IconRewindPlay, IconX } from '@posthog/icons'+import { IconRewindPlay, IconX } from '@posthog/icons'import { LemonButton } from '@posthog/lemon-ui'import { Resizer } from 'lib/components/Resizer/Resizer'import { ResizerLogicProps, resizerLogic } from 'lib/components/Resizer/resizerLogic'import { SceneMenuBarFileItems } from 'lib/components/Scenes/SceneMenuBarFileItems'-import { ScrollableShadows } from 'lib/components/ScrollableShadows/ScrollableShadows'import { TZLabel } from 'lib/components/TZLabel'import ViewRecordingsPlaylistButton from 'lib/components/ViewRecordingButton/ViewRecordingsPlaylistButton'import { useFeatureFlag } from 'lib/hooks/useFeatureFlag'import { useWindowSize } from 'lib/hooks/useWindowSize'-import {- TabsPrimitive,- TabsPrimitiveContent,- TabsPrimitiveList,- TabsPrimitiveTrigger,-} from 'lib/ui/TabsPrimitive/TabsPrimitive'import { newInternalTab } from 'lib/utils/newInternalTab'import { SceneExport } from 'scenes/sceneTypes'import { urls } from 'scenes/urls'@@ -33,29 +26,20 @@ import { ReplayTabs } from '~/types'import { useAttachedContext } from 'products/posthog_ai/frontend/api/logics'import { PostHogSDKIssueBanner } from '../../components/Banners/PostHogSDKIssueBanner'-import { breakdownFiltersLogic } from '../../components/Breakdowns/breakdownFiltersLogic'-import { BreakdownsChart } from '../../components/Breakdowns/BreakdownsChart'-import { BreakdownsSearchBar } from '../../components/Breakdowns/BreakdownsSearchBar'-import { MiniBreakdowns } from '../../components/Breakdowns/MiniBreakdowns'import { miniBreakdownsLogic } from '../../components/Breakdowns/miniBreakdownsLogic'import { ExceptionCard } from '../../components/ExceptionCard'import { StackTraceActions } from '../../components/ExceptionCard/Tabs/StackTraceTab/StackTraceActions'import { StatusIndicator } from '../../components/Indicators'-import { issueFiltersLogic } from '../../components/IssueFilters/issueFiltersLogic'+import {+ ERROR_TRACKING_ISSUE_SCENE_LOGIC_KEY,+ issueFiltersLogic,+} from '../../components/IssueFilters/issueFiltersLogic'import { IssueStatusButton } from '../../components/IssueStatusButton'import { ErrorTrackingSetupPrompt } from '../../components/SetupPrompt/SetupPrompt'import { StyleVariables } from '../../components/StyleVariables'import { useErrorTagRenderer } from '../../hooks/use-error-tag-renderer'import { getIssueReplayDateRange, getIssueReplayFilterGroup } from '../../utils'-import {- ErrorTrackingIssueSceneCategory,- errorTrackingIssueSceneConfigurationLogic,-} from './errorTrackingIssueSceneConfigurationLogic'-import {- ERROR_TRACKING_ISSUE_SCENE_LOGIC_KEY,- ErrorTrackingIssueSceneLogicProps,- errorTrackingIssueSceneLogic,-} from './errorTrackingIssueSceneLogic'+import { ErrorTrackingIssueSceneLogicProps, errorTrackingIssueSceneLogic } from './errorTrackingIssueSceneLogic'import { IssueEventsPanel } from './IssueEventsPanel'import { LinkedReports } from './LinkedReports'import { ErrorTrackingIssueScenePanel } from './ScenePanel'@@ -76,12 +60,6 @@ export function ErrorTrackingIssueScene(): JSX.Element {const sceneMenuBarEnabled = useFeatureFlag('SCENE_MENU_BAR')const hasIssueSplitting = useFeatureFlag('ERROR_TRACKING_ISSUE_SPLITTING')- // breakdownFiltersLogic is a keyless singleton that miniBreakdownsLogic connects to. Mounting it here ties its- // lifecycle to the scene (the stable parent), so it is torn down after the keyed miniBreakdownsLogic below rather- // than mid-cascade — otherwise its store path can vanish while miniBreakdownsLogic's connected selectors still- // re-evaluate, throwing "Can not find path breakdownFiltersLogic".- useMountedLogic(breakdownFiltersLogic)-useAttachedContext(issueId ? [{ type: 'error_tracking_issue', key: issueId, label: issue?.name ?? undefined }] : null)@@ -231,8 +209,10 @@ const RightHandColumn = ({isOpen: booleanonClose: () => void}): JSX.Element | null => {- const { issue, issueLoading, selectedEvent, initialEventLoading } = useValues(errorTrackingIssueSceneLogic)+ const { issue, issueLoading, selectedEvent, initialEvent, initialEventLoading } =+ useValues(errorTrackingIssueSceneLogic)const tagRenderer = useErrorTagRenderer()+ const detailEvent = selectedEvent ?? initialEventif (isMobile && !isOpen) {return null@@ -250,23 +230,23 @@ const RightHandColumn = ({{isMobile && (<div className="flex items-center justify-between p-1 shrink-0"><div className="flex items-center gap-1 pl-1">- {selectedEvent?.timestamp && (- <TZLabel className="text-muted text-xs" time={selectedEvent.timestamp} />+ {detailEvent?.timestamp && (+ <TZLabel className="text-muted text-xs" time={detailEvent.timestamp} />)}- {tagRenderer(selectedEvent)}+ {tagRenderer(detailEvent)}</div><LemonButton icon={<IconX />} size="small" onClick={onClose} aria-label="Close detail" /></div>)}- <PostHogSDKIssueBanner event={selectedEvent} />+ <PostHogSDKIssueBanner event={detailEvent} /><LinkedReports /><div className="flex-1 min-h-0 flex flex-col"><ExceptionCardissueId={issue?.id ?? 'no-issue'}issueName={issue?.name ?? null}loading={issueLoading || initialEventLoading}- event={selectedEvent ?? undefined}- label={tagRenderer(selectedEvent)}+ event={detailEvent ?? undefined}+ label={tagRenderer(detailEvent)}hideEventMeta={isMobile}renderStackTraceActions={() => {return issue ? <StackTraceActions issue={issue} /> : null@@ -278,10 +258,6 @@ const RightHandColumn = ({}const LeftHandColumn = ({ isMobile }: { isMobile: boolean }): JSX.Element => {- const { category } = useValues(errorTrackingIssueSceneConfigurationLogic)- const { setCategory } = useActions(errorTrackingIssueSceneConfigurationLogic)- const { issueId } = useValues(errorTrackingIssueSceneLogic)-const ref = useRef<HTMLDivElement>(null)const resizerLogicProps: ResizerLogicProps = {containerRef: ref,@@ -306,47 +282,9 @@ const LeftHandColumn = ({ isMobile }: { isMobile: boolean }): JSX.Element => {}className={clsx('flex flex-col h-full relative bg-surface-primary', isMobile && 'flex-1 max-w-full')}>- <TabsPrimitive- value={category}- onValueChange={(value) => {- setCategory(value as ErrorTrackingIssueSceneCategory)- posthog.capture('error_tracking_issue_tab_viewed', { issue_id: issueId, tab: value })- }}- className="flex flex-col flex-1 min-h-0"- >- <div>- <ScrollableShadows direction="horizontal" className="border-b" hideScrollbars>- <TabsPrimitiveList className="flex space-x-0.5 gap-2">- <TabsPrimitiveTrigger className="flex items-center px-2 py-1.5" value="exceptions">- <IconList className="mr-1" />- <span className="text-nowrap">Exceptions</span>- </TabsPrimitiveTrigger>- <TabsPrimitiveTrigger className="flex items-center px-2 py-1.5" value="breakdowns">- <IconFilter className="mr-1" />- <span className="text-nowrap">Breakdowns</span>- </TabsPrimitiveTrigger>- </TabsPrimitiveList>- </ScrollableShadows>- </div>- <TabsPrimitiveContent value="exceptions" className="h-full min-h-0">- <IssueEventsPanel />- </TabsPrimitiveContent>- <TabsPrimitiveContent value="breakdowns" className="flex-1 min-h-0">- <BreakdownsTab />- </TabsPrimitiveContent>- </TabsPrimitive>+ <IssueEventsPanel />{!isMobile && <Resizer {...resizerLogicProps} />}</div>)}--const BreakdownsTab = (): JSX.Element => {- return (- <div className="flex flex-col h-full">- <BreakdownsSearchBar />- <MiniBreakdowns />- <BreakdownsChart />- </div>- )-}diff --git a/products/error_tracking/frontend/scenes/ErrorTrackingIssueScene/IssueEventsEmptyState.test.tsx b/products/error_tracking/frontend/scenes/ErrorTrackingIssueScene/IssueEventsEmptyState.test.tsxnew file mode 100644index 000000000000..4e3611556e05--- /dev/null+++ b/products/error_tracking/frontend/scenes/ErrorTrackingIssueScene/IssueEventsEmptyState.test.tsx@@ -0,0 +1,54 @@+import '@testing-library/jest-dom'++import { cleanup, render, screen } from '@testing-library/react'+import userEvent from '@testing-library/user-event'++import { IssueEventsEmptyState } from './IssueEventsEmptyState'++describe('IssueEventsEmptyState', () => {+ afterEach(() => cleanup())++ it.each([+ { nextDateRangeLabel: '30 days', hasActiveFilters: true, dateButton: true, filterButton: true },+ { nextDateRangeLabel: '30 days', hasActiveFilters: false, dateButton: true, filterButton: false },+ { nextDateRangeLabel: null, hasActiveFilters: true, dateButton: false, filterButton: true },+ { nextDateRangeLabel: null, hasActiveFilters: false, dateButton: false, filterButton: false },+ ])(+ 'shows the relevant recovery actions for $nextDateRangeLabel and filters=$hasActiveFilters',+ ({ nextDateRangeLabel, hasActiveFilters, dateButton, filterButton }) => {+ render(+ <IssueEventsEmptyState+ nextDateRangeLabel={nextDateRangeLabel}+ hasActiveFilters={hasActiveFilters}+ loading={false}+ onIncreaseDateRange={jest.fn()}+ onClearFilters={jest.fn()}+ />+ )++ expect(Boolean(screen.queryByText(/Show last/))).toBe(dateButton)+ expect(Boolean(screen.queryByText('Remove filters'))).toBe(filterButton)+ }+ )++ it('runs the recovery actions', async () => {+ const onIncreaseDateRange = jest.fn()+ const onClearFilters = jest.fn()++ render(+ <IssueEventsEmptyState+ nextDateRangeLabel="30 days"+ hasActiveFilters+ loading={false}+ onIncreaseDateRange={onIncreaseDateRange}+ onClearFilters={onClearFilters}+ />+ )++ await userEvent.click(screen.getByText('Show last 30 days'))+ await userEvent.click(screen.getByText('Remove filters'))++ expect(onIncreaseDateRange).toHaveBeenCalledTimes(1)+ expect(onClearFilters).toHaveBeenCalledTimes(1)+ })+})diff --git a/products/error_tracking/frontend/scenes/ErrorTrackingIssueScene/IssueEventsEmptyState.tsx b/products/error_tracking/frontend/scenes/ErrorTrackingIssueScene/IssueEventsEmptyState.tsxnew file mode 100644index 000000000000..6e7281b3ea01--- /dev/null+++ b/products/error_tracking/frontend/scenes/ErrorTrackingIssueScene/IssueEventsEmptyState.tsx@@ -0,0 +1,57 @@+import { IconCalendar, IconFilter } from '@posthog/icons'++import { Button, Heading, Text } from 'lib/ui/quill'++export interface IssueEventsEmptyStateProps {+ nextDateRangeLabel: string | null+ hasActiveFilters: boolean+ loading: boolean+ onIncreaseDateRange: () => void+ onClearFilters: () => void+}++export function IssueEventsEmptyState({+ nextDateRangeLabel,+ hasActiveFilters,+ loading,+ onIncreaseDateRange,+ onClearFilters,+}: IssueEventsEmptyStateProps): JSX.Element {+ const detail = hasActiveFilters+ ? nextDateRangeLabel+ ? 'Try a wider date range or remove filters.'+ : 'Remove filters to see more exceptions.'+ : nextDateRangeLabel+ ? 'Try a wider date range to see earlier exceptions.'+ : 'No exceptions match this date range.'++ return (+ <div className="flex min-h-64 flex-1 items-center justify-center px-4 py-8 text-center">+ <div className="flex max-w-md flex-col items-center gap-3">+ <div className="flex size-10 items-center justify-center rounded-full bg-fill-secondary text-secondary">+ <IconCalendar className="size-5" />+ </div>+ <div className="flex flex-col gap-1">+ <Heading size="base">No exceptions found</Heading>+ <Text size="sm" variant="muted">+ {detail}+ </Text>+ </div>+ <div className="flex flex-wrap items-center justify-center gap-2">+ {nextDateRangeLabel && (+ <Button variant="outline" loading={loading} onClick={onIncreaseDateRange}>+ <IconCalendar />+ Show last {nextDateRangeLabel}+ </Button>+ )}+ {hasActiveFilters && (+ <Button variant="outline" disabled={loading} onClick={onClearFilters}>+ <IconFilter />+ Remove filters+ </Button>+ )}+ </div>+ </div>+ </div>+ )+}diff --git a/products/error_tracking/frontend/scenes/ErrorTrackingIssueScene/IssueEventsPanel.test.ts b/products/error_tracking/frontend/scenes/ErrorTrackingIssueScene/IssueEventsPanel.test.tsnew file mode 100644index 000000000000..837662101740--- /dev/null+++ b/products/error_tracking/frontend/scenes/ErrorTrackingIssueScene/IssueEventsPanel.test.ts@@ -0,0 +1,46 @@+import type { ErrorEventType } from 'lib/components/Errors/types'++import { getListSelection } from './IssueEventsPanel'++const events = [{ uuid: 'event-1' }, { uuid: 'event-2' }] as ErrorEventType[]++describe('getListSelection', () => {+ it.each([+ // A selection present on the loaded page is always kept, regardless of pagination.+ { selectedEvent: events[1], canLoadMore: false, queryChanged: false, expected: events[1] },+ { selectedEvent: events[1], canLoadMore: true, queryChanged: false, expected: events[1] },+ // A selection absent from a fully loaded list falls back to the newest event.+ {+ selectedEvent: { uuid: 'missing' } as ErrorEventType,+ canLoadMore: false,+ queryChanged: false,+ expected: events[0],+ },+ // A filter change proves the old selection belongs to a different result set.+ {+ selectedEvent: { uuid: 'missing' } as ErrorEventType,+ canLoadMore: true,+ queryChanged: true,+ expected: events[0],+ },+ // No selection always falls back to the newest event.+ { selectedEvent: null, canLoadMore: false, queryChanged: false, expected: events[0] },+ { selectedEvent: null, canLoadMore: true, queryChanged: false, expected: events[0] },+ ])(+ 'reconciles the current selection with the loaded list',+ ({ selectedEvent, canLoadMore, queryChanged, expected }) => {+ expect(getListSelection(events, selectedEvent, canLoadMore, queryChanged)).toBe(expected)+ }+ )++ it('keeps a selection missing from the loaded page while more pages can load', () => {+ // A timestamp-linked exception can live past the first page; reconciling it to the newest+ // event here would rewrite the URL and lose the linked exception the user opened.+ const linkedEvent = { uuid: 'missing' } as ErrorEventType+ expect(getListSelection(events, linkedEvent, true, false)).toBe(linkedEvent)+ })++ it('closes the selection for an empty list', () => {+ expect(getListSelection([], events[0], false, false)).toBeNull()+ })+})diff --git a/products/error_tracking/frontend/scenes/ErrorTrackingIssueScene/IssueEventsPanel.tsx b/products/error_tracking/frontend/scenes/ErrorTrackingIssueScene/IssueEventsPanel.tsxindex 63ad5679b217..8cd6c673e3b0 100644--- a/products/error_tracking/frontend/scenes/ErrorTrackingIssueScene/IssueEventsPanel.tsx+++ b/products/error_tracking/frontend/scenes/ErrorTrackingIssueScene/IssueEventsPanel.tsx@@ -1,15 +1,17 @@import { useActions, useValues } from 'kea'-import { PropsWithChildren } from 'react'+import { PropsWithChildren, useEffect, useRef } from 'react'-import { IconRefresh } from '@posthog/icons'--import { Button, Tooltip, TooltipContent, TooltipTrigger } from 'lib/ui/quill'+import { ErrorEventType } from 'lib/components/Errors/types'import { eventsSourceLogic } from '../../components/EventsTable/eventsSourceLogic'import { EventsTable, EventsTableLoading } from '../../components/EventsTable/EventsTable'-import { ErrorFilters } from '../../components/IssueFilters'-import { Metadata } from '../../components/IssueMetadata'+import { issueFilterPreviewLogic } from '../../components/IssueFilterPreview/issueFilterPreviewLogic'+import { IssueFilterPreviewPanel } from '../../components/IssueFilterPreview/IssueFilterPreviewPanel'+import { getNextErrorTrackingDateRange } from '../../components/IssueFilters/DateRange'+import { issueFiltersLogic } from '../../components/IssueFilters/issueFiltersLogic'import { errorTrackingIssueSceneLogic } from './errorTrackingIssueSceneLogic'+import { IssueEventsEmptyState } from './IssueEventsEmptyState'+import { IssueEventsToolbar } from './IssueEventsToolbar'export function IssueEventsPanel(): JSX.Element {const { issueFingerprintsLoading } = useValues(errorTrackingIssueSceneLogic)@@ -26,12 +28,33 @@ export function IssueEventsPanel(): JSX.Element {}function LoadedIssueEventsPanel(): JSX.Element {- const { eventsQuery, eventsQueryKey, selectedEvent, issueFingerprints, summary } =- useValues(errorTrackingIssueSceneLogic)- const { selectEvent } = useActions(errorTrackingIssueSceneLogic)+ const { eventsQuery, eventsQueryKey, selectedEvent, summary } = useValues(errorTrackingIssueSceneLogic)+ const { selectEvent, setMobileDetailOpen } = useActions(errorTrackingIssueSceneLogic)+ const { dateRange } = useValues(issueFiltersLogic)+ const { hasActiveFilters } = useValues(issueFilterPreviewLogic)+ const { clearNonDateFilters } = useActions(issueFilterPreviewLogic)+ const { setDateRange } = useActions(issueFiltersLogic)const dataSource = eventsSourceLogic({ query: eventsQuery, queryKey: eventsQueryKey })const { items, itemsLoading, canLoadNextData } = useValues(dataSource)const { loadData, loadNextData } = useActions(dataSource)+ const nextDateRange = getNextErrorTrackingDateRange(dateRange)+ const previousEventsQueryKey = useRef(eventsQueryKey)++ useEffect(() => {+ if (itemsLoading) {+ return+ }++ const queryChanged = previousEventsQueryKey.current !== eventsQueryKey+ previousEventsQueryKey.current = eventsQueryKey+ const nextSelection = getListSelection(items, selectedEvent, canLoadNextData, queryChanged)+ if (nextSelection !== selectedEvent) {+ selectEvent(nextSelection)+ }+ if (!nextSelection) {+ setMobileDetailOpen(false)+ }+ }, [items, itemsLoading, canLoadNextData, eventsQueryKey, selectEvent, selectedEvent, setMobileDetailOpen])return (<IssueEventsLayout@@ -43,8 +66,18 @@ function LoadedIssueEventsPanel(): JSX.Element {}}}>- {issueFingerprints.length === 0 ? (- <div className="px-2 py-3 text-sm text-muted-foreground">No exceptions found for this issue.</div>+ {!itemsLoading && items.length === 0 ? (+ <IssueEventsEmptyState+ nextDateRangeLabel={nextDateRange?.label ?? null}+ hasActiveFilters={hasActiveFilters}+ loading={itemsLoading}+ onIncreaseDateRange={() => {+ if (nextDateRange) {+ setDateRange(nextDateRange.dateRange)+ }+ }}+ onClearFilters={clearNonDateFilters}+ />) : (<EventsTableitems={items}@@ -61,6 +94,24 @@ function LoadedIssueEventsPanel(): JSX.Element {)}+export function getListSelection(+ items: ErrorEventType[],+ selectedEvent: ErrorEventType | null,+ canLoadMore: boolean,+ queryChanged: boolean+): ErrorEventType | null {+ const matchedEvent = selectedEvent ? items.find((item) => item.uuid === selectedEvent.uuid) : undefined+ if (matchedEvent) {+ return matchedEvent+ }+ // A later page of the same query may hold a timestamp-linked exception older than the first+ // 100 rows. A new query cannot make that claim, so filter changes reconcile immediately.+ if (selectedEvent && canLoadMore && !queryChanged) {+ return selectedEvent+ }+ return items[0] ?? null+}+function IssueEventsLayout({children,loading,@@ -73,44 +124,10 @@ function IssueEventsLayout({}>): JSX.Element {return (<div className="flex h-full min-h-0 flex-col">- <Metadata className="flex min-h-0 flex-1 flex-col" onScrollNearEnd={onScrollNearEnd}>- <div className="sticky top-0 z-10 shrink-0 border-y border-primary bg-surface-primary px-2 py-2">- <ErrorFilters.Root className="w-full">- <div className="flex w-full flex-col gap-1">- <div className="flex w-full flex-wrap items-center gap-1">- <Tooltip>- <TooltipTrigger- render={- <Button- variant="outline"- size="icon"- loading={loading}- aria-label="Reload exceptions"- onClick={() => onReload?.()}- />- }- >- <IconRefresh />- </TooltipTrigger>- <TooltipContent>Reload exceptions</TooltipContent>- </Tooltip>- <ErrorFilters.DateRange />- <div className="ml-auto shrink-0">- <ErrorFilters.InternalAccounts />- </div>- </div>- <div className="flex w-full flex-wrap items-center gap-1">- <ErrorFilters.Search- className="w-auto min-w-40 flex-1 shrink"- placeholder="Search exceptions"- />- <ErrorFilters.FilterGroup />- </div>- </div>- </ErrorFilters.Root>- </div>+ <IssueFilterPreviewPanel className="flex min-h-0 flex-1 flex-col" onScrollNearEnd={onScrollNearEnd}>+ <IssueEventsToolbar loading={loading} onReload={onReload} />{children}- </Metadata>+ </IssueFilterPreviewPanel></div>)}diff --git a/products/error_tracking/frontend/scenes/ErrorTrackingIssueScene/IssueEventsToolbar.tsx b/products/error_tracking/frontend/scenes/ErrorTrackingIssueScene/IssueEventsToolbar.tsxnew file mode 100644index 000000000000..3a12df68d29b--- /dev/null+++ b/products/error_tracking/frontend/scenes/ErrorTrackingIssueScene/IssueEventsToolbar.tsx@@ -0,0 +1,54 @@+import { IconRefresh } from '@posthog/icons'++import { Button, Tooltip, TooltipContent, TooltipTrigger } from 'lib/ui/quill'++import { ErrorFilters } from '../../components/IssueFilters'++interface IssueEventsToolbarProps {+ loading: boolean+ onReload?: () => void+}++export function IssueEventsToolbar({ loading, onReload }: IssueEventsToolbarProps): JSX.Element {+ return (+ <div className="sticky top-0 z-10 shrink-0 border-y border-primary bg-surface-primary">+ <ErrorFilters.Root className="w-full">+ <ErrorFilters.FilterGroup+ iconOnly+ renderControls={({ filterPicker, activeFilters }) => (+ <div className="flex w-full flex-col gap-2 p-2">+ <div className="flex w-full min-w-0 flex-wrap items-center gap-2">+ <Tooltip>+ <TooltipTrigger+ render={+ <Button+ variant="outline"+ size="icon"+ loading={loading}+ aria-label="Reload exceptions"+ onClick={onReload}+ />+ }+ >+ <IconRefresh />+ </TooltipTrigger>+ <TooltipContent>Reload exceptions</TooltipContent>+ </Tooltip>+ <ErrorFilters.DateRange />+ <ErrorFilters.Search+ className="w-auto min-w-40 flex-1 shrink"+ placeholder="Search exceptions"+ endAddon={filterPicker}+ />+ <div className="shrink-0">+ <ErrorFilters.InternalAccounts />+ </div>+ </div>+ {activeFilters}+ </div>+ )}+ />+ </ErrorFilters.Root>+ </div>+ )+}diff --git a/products/error_tracking/frontend/scenes/ErrorTrackingIssueScene/errorTrackingIssueSceneConfigurationLogic.ts b/products/error_tracking/frontend/scenes/ErrorTrackingIssueScene/errorTrackingIssueSceneConfigurationLogic.tsdeleted file mode 100644index af5ce2fe10c0..000000000000--- a/products/error_tracking/frontend/scenes/ErrorTrackingIssueScene/errorTrackingIssueSceneConfigurationLogic.ts+++ /dev/null@@ -1,47 +0,0 @@-import { MakeLogicType, actions, defaults, kea, path, reducers } from 'kea'--export type ErrorTrackingIssueSceneCategory = 'exceptions' | 'breakdowns'--export const VALID_CATEGORIES: ErrorTrackingIssueSceneCategory[] = ['exceptions', 'breakdowns']-export const DEFAULT_CATEGORY: ErrorTrackingIssueSceneCategory = 'exceptions'--// Generated by kea-typegen. Update if you're an agent, ignore if you're human.-export interface errorTrackingIssueSceneConfigurationLogicValues {- category: ErrorTrackingIssueSceneCategory-}--// Generated by kea-typegen. Update if you're an agent, ignore if you're human.-export interface errorTrackingIssueSceneConfigurationLogicActions {- setCategory: (category: ErrorTrackingIssueSceneCategory) => {- category: ErrorTrackingIssueSceneCategory- }-}--export type errorTrackingIssueSceneConfigurationLogicType = MakeLogicType<- errorTrackingIssueSceneConfigurationLogicValues,- errorTrackingIssueSceneConfigurationLogicActions->--export const errorTrackingIssueSceneConfigurationLogic = kea<errorTrackingIssueSceneConfigurationLogicType>([- path([- 'products',- 'error_tracking',- 'scenes',- 'ErrorTrackingIssueScene',- 'errorTrackingIssueSceneConfigurationLogic',- ]),-- actions({- setCategory: (category: ErrorTrackingIssueSceneCategory) => ({ category }),- }),-- defaults({- category: DEFAULT_CATEGORY as ErrorTrackingIssueSceneCategory,- }),-- reducers(() => ({- category: {- setCategory: (_, { category }) => category,- },- })),-])diff --git a/products/error_tracking/frontend/scenes/ErrorTrackingIssueScene/errorTrackingIssueSceneLogic.test.ts b/products/error_tracking/frontend/scenes/ErrorTrackingIssueScene/errorTrackingIssueSceneLogic.test.tsindex 04d3672fbb15..2a8b279d9e25 100644--- a/products/error_tracking/frontend/scenes/ErrorTrackingIssueScene/errorTrackingIssueSceneLogic.test.ts+++ b/products/error_tracking/frontend/scenes/ErrorTrackingIssueScene/errorTrackingIssueSceneLogic.test.ts@@ -1,6 +1,7 @@import { expectLogic } from 'kea-test-utils'import { ErrorTrackingFingerprint } from 'lib/components/Errors/types'+import type { ErrorEventType } from 'lib/components/Errors/types'import { useMocks } from '~/mocks/jest'import { initKeaTests } from '~/test/init'@@ -65,6 +66,14 @@ describe('errorTrackingIssueSceneLogic', () => {.toMatchValues({ initialEvent: null })})+ it('allows the event selection to close', () => {+ const event = { uuid: 'event-1' } as ErrorEventType+ logic.actions.selectEvent(event)+ logic.actions.selectEvent(null)++ expect(logic.values.selectedEvent).toBeNull()+ })+it('keeps stable first and last event IDs in the issue summary', () => {expect(toErrorTrackingIssueSummary({diff --git a/products/error_tracking/frontend/scenes/ErrorTrackingIssueScene/errorTrackingIssueSceneLogic.ts b/products/error_tracking/frontend/scenes/ErrorTrackingIssueScene/errorTrackingIssueSceneLogic.tsindex e55b98372d0e..dc94c894f8f8 100644--- a/products/error_tracking/frontend/scenes/ErrorTrackingIssueScene/errorTrackingIssueSceneLogic.ts+++ b/products/error_tracking/frontend/scenes/ErrorTrackingIssueScene/errorTrackingIssueSceneLogic.ts@@ -55,6 +55,7 @@ import type {import { issueActionsLogic } from '../../components/IssueActions/issueActionsLogic'import {DEFAULT_DATE_RANGE,+ ERROR_TRACKING_ISSUE_SCENE_LOGIC_KEY,issueFiltersLogic,triggerFilterActions,updateFilterSearchParams,@@ -62,12 +63,6 @@ import {import { errorTrackingIssueEventsQuery, errorTrackingIssueQuery } from '../../queries'import { syncSearchParams } from '../../utils'import { ERROR_TRACKING_DETAILS_RESOLUTION, dateRangeToIsoBounds } from '../../utils'-import {- DEFAULT_CATEGORY,- ErrorTrackingIssueSceneCategory,- VALID_CATEGORIES,- errorTrackingIssueSceneConfigurationLogic,-} from './errorTrackingIssueSceneConfigurationLogic'export interface ErrorTrackingIssueSceneLogicProps {id: ErrorTrackingIssue['id']@@ -77,15 +72,11 @@ export interface ErrorTrackingIssueSceneLogicProps {export type ErrorTrackingIssueStatus = ErrorTrackingIssue['status']-export const ERROR_TRACKING_ISSUE_SCENE_LOGIC_KEY = 'ErrorTrackingIssueScene'-/** An issue realistically groups into one or two reports. This only stops the endpoint's 100-report* default page from serializing far more than the panel will ever show. */const LINKED_REPORTS_LIMIT = 10-// Generated by kea-typegen. Update if you're an agent, ignore if you're human.export interface errorTrackingIssueSceneLogicValues {- category: ErrorTrackingIssueSceneCategory // errorTrackingIssueSceneConfigurationLogicdateRange: DateRange // issueFiltersLogicfilterGroup: UniversalFiltersGroup // issueFiltersLogicfilterTestAccounts: boolean // issueFiltersLogic@@ -120,9 +111,6 @@ export interface errorTrackingIssueSceneLogicValues {// Generated by kea-typegen. Update if you're an agent, ignore if you're human.export interface errorTrackingIssueSceneLogicActions {- setCategory: (category: ErrorTrackingIssueSceneCategory) => {- category: ErrorTrackingIssueSceneCategory- } // errorTrackingIssueSceneConfigurationLogicupdateIssueAssignee: (id: string,assignee: ErrorTrackingIssueAssignee | null@@ -151,10 +139,18 @@ export interface errorTrackingIssueSceneLogicActions {id: stringstatus: import('~/queries/schema').ErrorTrackingIssueStatus} // issueActionsLogic- setDateRange: (dateRange: DateRange) => {+ setDateRange: (+ dateRange: DateRange,+ fromPreview?: boolean | undefined+ ) => {dateRange: DateRange+ fromPreview: boolean} // issueFiltersLogic- setFilterGroup: (filterGroup: UniversalFiltersGroup) => {+ setFilterGroup: (+ filterGroup: UniversalFiltersGroup,+ filterAddedFromPreview?: number | undefined+ ) => {+ filterAddedFromPreview: numberfilterGroup: UniversalFiltersGroup} // issueFiltersLogicsetFilterTestAccounts: (filterTestAccounts: boolean) => {@@ -560,16 +556,12 @@ export const errorTrackingIssueSceneLogic = kea<errorTrackingIssueSceneLogicTypevalues: [issueFiltersLogic({ logicKey: ERROR_TRACKING_ISSUE_SCENE_LOGIC_KEY }),['dateRange', 'filterTestAccounts', 'filterGroup', 'searchQuery'],- errorTrackingIssueSceneConfigurationLogic,- ['category'],],actions: [issueFiltersLogic({ logicKey: ERROR_TRACKING_ISSUE_SCENE_LOGIC_KEY }),['setDateRange', 'setFilterTestAccounts', 'setFilterGroup', 'setSearchQuery'],issueActionsLogic,['updateIssueAssignee', 'updateIssueStatus', 'updateIssueName', 'updateIssueDescription'],- errorTrackingIssueSceneConfigurationLogic,- ['setCategory'],],})),@@ -608,7 +600,7 @@ export const errorTrackingIssueSceneLogic = kea<errorTrackingIssueSceneLogicTypelistDateRange: null as DateRange | null,}),- reducers(({ values }) => ({+ reducers({summary: {},lastSeen: {setLastSeen: (prevLastSeen, { lastSeen }) => {@@ -632,12 +624,7 @@ export const errorTrackingIssueSceneLogic = kea<errorTrackingIssueSceneLogicType},},selectedEvent: {- selectEvent: (_, { event }) => {- if (!event && values.initialEvent) {- return values.initialEvent- }- return event- },+ selectEvent: (_, { event }) => event,},mobileDetailOpen: {setMobileDetailOpen: (_, { mobileDetailOpen }) => mobileDetailOpen,@@ -645,7 +632,7 @@ export const errorTrackingIssueSceneLogic = kea<errorTrackingIssueSceneLogicTypelistDateRange: {setListDateRange: (_, { dateRange }) => dateRange,},- })),+ }),loaders(({ values, actions, props }) => ({issue: {@@ -725,7 +712,10 @@ export const errorTrackingIssueSceneLogic = kea<errorTrackingIssueSceneLogicType},},summary: {- loadSummary: async () => {+ loadSummary: async (_, breakpoint) => {+ // A reset dispatches several filter changes in one tick. Debounce them into one query,+ // then discard its response if a newer load supersedes it while it is in flight.+ await breakpoint(100)const response = await api.query(errorTrackingIssueQuery({issueId: props.id,@@ -740,6 +730,7 @@ export const errorTrackingIssueSceneLogic = kea<errorTrackingIssueSceneLogicType}),{ refresh: 'blocking' })+ breakpoint()if (!response.results.length) {return null}@@ -974,11 +965,6 @@ export const errorTrackingIssueSceneLogic = kea<errorTrackingIssueSceneLogicTypeactions.setListDateRange(params.dateRange ?? DEFAULT_DATE_RANGE)}triggerFilterActions(params, values, actions)- const tab = params.tab as ErrorTrackingIssueSceneCategory | undefined- const category = tab && VALID_CATEGORIES.includes(tab) ? tab : DEFAULT_CATEGORY- if (category !== values.category) {- actions.setCategory(category)- }},}}),@@ -987,11 +973,7 @@ export const errorTrackingIssueSceneLogic = kea<errorTrackingIssueSceneLogicTypeconst buildURL = (): ReturnType<typeof syncSearchParams> =>syncSearchParams(router, (params: Params) => {updateFilterSearchParams(params, values)- if (values.category === DEFAULT_CATEGORY) {- delete params.tab- } else {- params.tab = values.category- }+ delete params.tabreturn params})@@ -1000,7 +982,6 @@ export const errorTrackingIssueSceneLogic = kea<errorTrackingIssueSceneLogicTypesetFilterGroup: buildURL,setSearchQuery: buildURL,setFilterTestAccounts: buildURL,- setCategory: buildURL,}}),])diff --git a/products/error_tracking/frontend/scenes/ErrorTrackingScene/errorTrackingSceneLogic.ts b/products/error_tracking/frontend/scenes/ErrorTrackingScene/errorTrackingSceneLogic.tsindex 908b14967eb2..0cd87a50ec64 100644--- a/products/error_tracking/frontend/scenes/ErrorTrackingScene/errorTrackingSceneLogic.ts+++ b/products/error_tracking/frontend/scenes/ErrorTrackingScene/errorTrackingSceneLogic.ts@@ -79,10 +79,18 @@ export interface errorTrackingSceneLogicActions {mutationSuccess: (mutationName: string) => {mutationName: string} // issueActionsLogic- setDateRange: (dateRange: DateRange) => {+ setDateRange: (+ dateRange: DateRange,+ fromPreview?: boolean | undefined+ ) => {dateRange: DateRange+ fromPreview: boolean} // issueFiltersLogic- setFilterGroup: (filterGroup: UniversalFiltersGroup) => {+ setFilterGroup: (+ filterGroup: UniversalFiltersGroup,+ filterAddedFromPreview?: number | undefined+ ) => {+ filterAddedFromPreview: numberfilterGroup: UniversalFiltersGroup} // issueFiltersLogicsetFilterTestAccounts: (filterTestAccounts: boolean) => {diff --git a/products/error_tracking/frontend/scenes/ErrorTrackingScene/tabs/insights/errorTrackingInsightsLogic.ts b/products/error_tracking/frontend/scenes/ErrorTrackingScene/tabs/insights/errorTrackingInsightsLogic.tsindex b83584a57c71..0420cedce61d 100644--- a/products/error_tracking/frontend/scenes/ErrorTrackingScene/tabs/insights/errorTrackingInsightsLogic.ts+++ b/products/error_tracking/frontend/scenes/ErrorTrackingScene/tabs/insights/errorTrackingInsightsLogic.ts@@ -77,10 +77,18 @@ export interface errorTrackingInsightsLogicValues {// Generated by kea-typegen. Update if you're an agent, ignore if you're human.export interface errorTrackingInsightsLogicActions {- setDateRange: (dateRange: DateRange) => {+ setDateRange: (+ dateRange: DateRange,+ fromPreview?: boolean | undefined+ ) => {dateRange: DateRange+ fromPreview: boolean} // issueFiltersLogic- setFilterGroup: (filterGroup: UniversalFiltersGroup) => {+ setFilterGroup: (+ filterGroup: UniversalFiltersGroup,+ filterAddedFromPreview?: number | undefined+ ) => {+ filterAddedFromPreview: numberfilterGroup: UniversalFiltersGroup} // issueFiltersLogicsetFilterTestAccounts: (filterTestAccounts: boolean) => {