Skip to content

Conversation

@isabellaenriquez
Copy link
Member

Auto-opens the Reserve additional volume substep for customers that already have at least one category reserved above platform volume.

@linear
Copy link

linear bot commented Oct 10, 2025

@isabellaenriquez isabellaenriquez marked this pull request as ready for review October 10, 2025 18:35
@isabellaenriquez isabellaenriquez requested a review from a team as a code owner October 10, 2025 18:35
@github-actions github-actions bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Oct 10, 2025
cursor[bot]

This comment was marked as outdated.

Comment on lines 37 to 45
const [showSliders, setShowSliders] = useState<boolean>(
Object.values(subscription.categories)
.filter(({category}) => activePlan.checkoutCategories.includes(category))
.some(
({category, reserved}) =>
getBucket({buckets: activePlan.planCategories[category], events: reserved ?? 0})
.price > 0
)
);
Copy link
Contributor

Choose a reason for hiding this comment

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

Potential bug: The code may pass an `undefined` value to `getBucket` because it doesn't verify that a `category` key exists in `activePlan.planCategories` before access.
  • Description: The code iterates through subscription.categories and, for each category, checks if it's included in activePlan.checkoutCategories. However, it then directly accesses activePlan.planCategories[category] and passes the result to getBucket. The type definition for activePlan.planCategories is a Partial record, meaning a category can exist in checkoutCategories without a corresponding key in planCategories. In this scenario, undefined is passed to getBucket, which will throw an error and crash the component. This failure pattern is confirmed by existing production errors where getBucket fails when its buckets argument is undefined, such as in this issue.

  • Suggested fix: In the .filter() call, add a check to ensure that activePlan.planCategories[category] is truthy before attempting to use it. For example: .filter(({category}) =&gt; activePlan.checkoutCategories.includes(category) &amp;&amp; activePlan.planCategories[category]).
    severity: 0.85, confidence: 0.98

Did we get this right? 👍 / 👎 to inform future reviews.

@isabellaenriquez isabellaenriquez merged commit 99cc20f into master Oct 14, 2025
45 checks passed
@isabellaenriquez isabellaenriquez deleted the isabella/bil-1655 branch October 14, 2025 14:10
chromy pushed a commit that referenced this pull request Oct 17, 2025
…mes (#101357)

Auto-opens the `Reserve additional volume` substep for customers that
already have at least one category reserved above platform volume.
@github-actions github-actions bot locked and limited conversation to collaborators Oct 30, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Scope: Frontend Automatically applied to PRs that change frontend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants