Skip to content

fix(billing): Guard against undefined planDetails in SubscriptionHeader - #123888

Draft
sentry[bot] wants to merge 2 commits into
masterfrom
seer/fix/billing-plan-details-undefined
Draft

fix(billing): Guard against undefined planDetails in SubscriptionHeader#123888
sentry[bot] wants to merge 2 commits into
masterfrom
seer/fix/billing-plan-details-undefined

Conversation

@sentry

@sentry sentry Bot commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

This PR addresses a TypeError: Cannot read properties of undefined (reading 'name') that occurred on the /settings/billing/ page when subscription.planDetails was undefined.

The root cause was the SubscriptionHeader component attempting to access subscription.planDetails.name without a null guard, which happened for organizations without an active paid plan or in a transitional billing state.

Changes include:

  • In static/gsApp/views/subscriptionPage/subscriptionHeader.tsx:
    • Added a conditional check before calling getPlanIcon to ensure subscription.planDetails is defined.
    • Implemented optional chaining (subscription.planDetails?.name) and a fallback text (t('Subscription')) for the plan name display.
  • In static/gsApp/utils/billing.tsx:
    • Updated the supportsPayg function to use optional chaining (subscription.planDetails?.allowOnDemand) to prevent a similar crash when planDetails is undefined.
  • In static/gsApp/views/subscriptionPage/subscriptionHeader.spec.tsx:
    • Added a new test case to verify that the SubscriptionHeader component renders correctly with fallback text when planDetails is undefined.

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-3BPY

@sentry <feedback>: Autofix iterates on these changes
@sentry stop iterating: Autofix stops iterating on this run

This PR was automatically generated by Sentry. You can adjust this setting at any time.

@github-actions github-actions Bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Sep 9, 2026
@sentry sentry Bot changed the title fix(billing): Prevent crash when subscription planDetails is undefined fix(billing): Guard against undefined planDetails in SubscriptionHeader Sep 9, 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