Skip to content

Conversation

stnguyen90
Copy link
Contributor

@stnguyen90 stnguyen90 commented May 31, 2025

What does this PR do?

Fix a bug where creating an org w/o a coupon would result in undefined error.

Test Plan

Manual

Related PRs and Issues

Have you read the Contributing Guidelines on issues?

Yes

@stnguyen90 stnguyen90 moved this to Code Review in 1.7 Release May 31, 2025
@stnguyen90 stnguyen90 force-pushed the fix-create-pro-org branch from 02f5438 to 3c9b920 Compare May 31, 2025 22:10
@stnguyen90 stnguyen90 changed the title fix: fix creating org w/o coupon Fix creating org w/o coupon May 31, 2025
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes an undefined error when creating an organization without a coupon by simplifying the coupon code parameter.

  • Changed the coupon code argument from a ternary check to optional chaining.
  • Removed redundant ? selectedCoupon.code : null in favor of selectedCoupon?.code.

paymentMethodId,
null,
selectedCoupon.code ? selectedCoupon.code : null,
selectedCoupon?.code,
Copy link

Copilot AI May 31, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using selectedCoupon?.code can yield undefined when no coupon is selected, which may not match the API’s expected null value. Consider using selectedCoupon?.code ?? null to explicitly pass null in that case.

Suggested change
selectedCoupon?.code,
selectedCoupon?.code ?? null,

Copilot uses AI. Check for mistakes.

@stnguyen90 stnguyen90 merged commit b673448 into main Jun 1, 2025
2 checks passed
@stnguyen90 stnguyen90 deleted the fix-create-pro-org branch June 1, 2025 17:12
@github-project-automation github-project-automation bot moved this from Code Review to Done in 1.7 Release Jun 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants