Skip to content

fix(org-stats): Prevent TypeError when group.totals or group.series is undefined - #121052

Draft
sentry[bot] wants to merge 2 commits into
masterfrom
seer/fix/org-stats-undefined-totals
Draft

fix(org-stats): Prevent TypeError when group.totals or group.series is undefined#121052
sentry[bot] wants to merge 2 commits into
masterfrom
seer/fix/org-stats-undefined-totals

Conversation

@sentry

@sentry sentry Bot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

This PR addresses a TypeError: Cannot read properties of undefined (reading 'sum(quantity)') (JAVASCRIPT-3B74) that occurred in static/app/views/organizationStats/usageStatsProjects.tsx and static/app/views/organizationStats/mapSeriesToChart.ts.

The root cause was identified as the application attempting to access group.totals['sum(quantity)'] or group.series['sum(quantity)'] without proper null or undefined checks. The stats_v2 API can return group entries where the totals or series fields are missing (e.g., when there is no data for a specific outcome, category, or project combination).

The fix involves adding optional chaining (?.) and nullish coalescing (?? 0 or ?? []) to safely access these properties, ensuring that the application gracefully handles cases where group.totals or group.series might be undefined.

During the CI process, a formatting issue was identified by the pre-commit hook. This was resolved by extracting a potentially long inline expression into a separate variable to improve readability and adhere to the project's formatting standards.

Legal Boilerplate

Look, I get it. The entity doing business as "Sentry" was incorporated in the State of Delaware in 2015 as Functional Software, Inc. and is gonna need some rights from me in order to utilize my contributions in this here PR. So here's the deal: I retain all rights, title and interest in and to my contributions, and by keeping this boilerplate intact I confirm that Sentry can use, modify, copy, and redistribute my contributions, under Sentry's choice of terms.

Fixes JAVASCRIPT-3B74

Comment @sentry <feedback> on this PR to have Autofix iterate on the changes.

@github-actions github-actions Bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Aug 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Scope: Frontend Automatically applied to PRs that change frontend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants