:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
fix(error-tracking): guard status chip lookup against unknown issue status (#76073)
posthog[bot]224576ff4065
diff --git a/products/error_tracking/frontend/components/Indicators.test.tsx b/products/error_tracking/frontend/components/Indicators.test.tsxindex 19bed04881fe..d4bbea442ef7 100644--- a/products/error_tracking/frontend/components/Indicators.test.tsx+++ b/products/error_tracking/frontend/components/Indicators.test.tsx@@ -3,7 +3,7 @@ import '@testing-library/jest-dom'import { render, screen } from '@testing-library/react'import userEvent from '@testing-library/user-event'-import { StatusIndicator } from './Indicators'+import { IssueStatus, IssueStatusDot, StatusIndicator } from './Indicators'describe('StatusIndicator', () => {it('shows the status explanation on hover when requested', async () => {@@ -13,4 +13,16 @@ describe('StatusIndicator', () => {expect(await screen.findByText('Ongoing issue')).toBeInTheDocument()})++ it('renders a fallback instead of crashing for an unrecognized status', () => {+ render(<StatusIndicator status={'' as IssueStatus} />)++ expect(screen.getByText('Unknown')).toBeInTheDocument()+ })++ it('IssueStatusDot renders a fallback instead of crashing for an unrecognized status', () => {+ const { container } = render(<IssueStatusDot status={'' as IssueStatus} />)++ expect(container.firstChild).not.toBeNull()+ })})diff --git a/products/error_tracking/frontend/components/Indicators.tsx b/products/error_tracking/frontend/components/Indicators.tsxindex 494260ad1597..f13e9677d634 100644--- a/products/error_tracking/frontend/components/Indicators.tsx+++ b/products/error_tracking/frontend/components/Indicators.tsx@@ -51,6 +51,12 @@ interface IssueStatusConfig {tooltip?: string}+const UNKNOWN_STATUS_CONFIG: IssueStatusConfig = {+ color: '#6b7280',+ intentLabel: 'Unknown status',+ label: 'Unknown',+}+export const ISSUE_STATUS_CONFIG: Record<IssueStatus, IssueStatusConfig> = {active: {color: '#f59e0b',@@ -82,12 +88,18 @@ export const ISSUE_STATUS_CONFIG: Record<IssueStatus, IssueStatusConfig> = {},}-export const IssueStatusDot = ({ status, className }: { status: IssueStatus; className?: string }): JSX.Element => (- <Dot- className={clsx('!border-0 !p-0 [&_[data-slot=dot-inner]]:!bg-[var(--error-tracking-status-color)]', className)}- style={{ '--error-tracking-status-color': ISSUE_STATUS_CONFIG[status].color } as React.CSSProperties}- />-)+export const IssueStatusDot = ({ status, className }: { status: IssueStatus; className?: string }): JSX.Element => {+ const config = ISSUE_STATUS_CONFIG[status] ?? UNKNOWN_STATUS_CONFIG+ return (+ <Dot+ className={clsx(+ '!border-0 !p-0 [&_[data-slot=dot-inner]]:!bg-[var(--error-tracking-status-color)]',+ className+ )}+ style={{ '--error-tracking-status-color': config.color } as React.CSSProperties}+ />+ )+}interface StatusIndicatorProps {status: IssueStatus@@ -102,7 +114,7 @@ export const StatusIndicator = React.forwardRef<HTMLDivElement, StatusIndicatorP{ status, size = 'small', intent = false, className, withTooltip },ref): JSX.Element {- const config = ISSUE_STATUS_CONFIG[status]+ const config = ISSUE_STATUS_CONFIG[status] ?? UNKNOWN_STATUS_CONFIGconst tooltip = withTooltip ? config.tooltip : undefinedconst content = (<div ref={ref} className={clsx('flex items-center', className, sizeVariants[size])}>