Merge pull request #2105 from SkynetLabs/michalleszczyk/sky-652-fix-subscription-plans-view

Dashboard V2: Fix extraneous tiers on /payments screen
This commit is contained in:
Matthew Sevey 2022-05-25 08:50:57 -04:00 committed by GitHub
commit 98d6884391
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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);
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.