From b563ab05a9fd1f29283f4cbbc224a844da1a0d8b Mon Sep 17 00:00:00 2001 From: Rish Date: Thu, 3 Sep 2020 17:13:38 +0530 Subject: [PATCH] Fixed default plan for complimentary members refs https://github.com/TryGhost/members.js/issues/77 - Fixes members on complimentary plan not having a default plan selected on account plan page --- ghost/portal/src/components/pages/AccountPlanPage.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/ghost/portal/src/components/pages/AccountPlanPage.js b/ghost/portal/src/components/pages/AccountPlanPage.js index ee5317c55f..9549e46793 100644 --- a/ghost/portal/src/components/pages/AccountPlanPage.js +++ b/ghost/portal/src/components/pages/AccountPlanPage.js @@ -90,8 +90,11 @@ export default class AccountPlanPage extends React.Component { const {member} = this.context; const {plans} = this.context.site; this.plans = this.getPlansData({plans}); - const activePlan = this.getActivePlanName({member}) || this.plans[0].name; - + let activePlan = this.getActivePlanName({member}) || this.plans[0].name; + const activePlanExists = this.plans.some(d => d.name === activePlan); + if (!activePlanExists) { + activePlan = this.plans[0].name; + } this.state = { plan: activePlan };