From 19d203536a4ed1c3a5c2b17c497512b1d773b93d Mon Sep 17 00:00:00 2001 From: Abhinav-grd Date: Fri, 13 Aug 2021 21:29:28 +0530 Subject: [PATCH] add subscription only if exists --- src/components/pages/gallery/PlanSelector.tsx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/components/pages/gallery/PlanSelector.tsx b/src/components/pages/gallery/PlanSelector.tsx index d8721b2d1..fd6ece767 100644 --- a/src/components/pages/gallery/PlanSelector.tsx +++ b/src/components/pages/gallery/PlanSelector.tsx @@ -76,7 +76,7 @@ enum PLAN_PERIOD { } function PlanSelector(props: Props) { const subscription: Subscription = getUserSubscription(); - const [plans, setPlans] = useState(null); + const [plans, setPlans] = useState(null); const [planPeriod, setPlanPeriod] = useState(PLAN_PERIOD.YEAR); const togglePeriod = () => { setPlanPeriod((prevPeriod) => @@ -95,7 +95,11 @@ function PlanSelector(props: Props) { plans.filter((plan) => isUserSubscribedPlan(plan, subscription) ).length === 0; - if (!isOnFreePlan(subscription) && planNotListed) { + if ( + subscription && + !isOnFreePlan(subscription) && + planNotListed + ) { plans = [planForSubscription(subscription), ...plans]; } setPlans(plans);