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.
if (limits?.length) {
return limits.map((limitsDescriptor, index) => {
const asssociatedPlan = sortedPlans.find((plan) => plan.tier === index) || {};
return limits
.map((limitsDescriptor, index) => {
const asssociatedPlan = sortedPlans.find((plan) => plan.tier === index);
return {
...asssociatedPlan,
limits: limitsDescriptor || null,
};
});
if (asssociatedPlan) {
return {
...asssociatedPlan,
limits: limitsDescriptor || null,
};
}
return null;
})
.filter(Boolean);
}
// If we don't have the limits data yet, set just return the plans.