Dashboard V2: Fix extraneous tiers on /payments screen

This commit is contained in:
Michał Leszczyk 2022-05-24 18:58:12 +02:00
parent 3b142fe0d6
commit 599bdc1338
No known key found for this signature in database
GPG Key ID: FA123CA8BAA2FBF4
1 changed files with 13 additions and 7 deletions

View File

@ -19,14 +19,20 @@ const aggregatePlansAndLimits = (plans, limits, { includeFreePlan }) => {
// Decorate each plan with its corresponding limits data, if available. // Decorate each plan with its corresponding limits data, if available.
if (limits?.length) { if (limits?.length) {
return limits.map((limitsDescriptor, index) => { return limits
const asssociatedPlan = sortedPlans.find((plan) => plan.tier === index) || {}; .map((limitsDescriptor, index) => {
const asssociatedPlan = sortedPlans.find((plan) => plan.tier === index);
if (asssociatedPlan) {
return { return {
...asssociatedPlan, ...asssociatedPlan,
limits: limitsDescriptor || null, limits: limitsDescriptor || null,
}; };
}); }
return null;
})
.filter(Boolean);
} }
// If we don't have the limits data yet, set just return the plans. // If we don't have the limits data yet, set just return the plans.