From 79105b086dc4bcebe994457e17e72cb03acfde5c Mon Sep 17 00:00:00 2001 From: Dominik Guzei Date: Thu, 5 Sep 2019 17:28:21 +0200 Subject: Fix race condition when team data is not yet loaded --- src/stores/UserStore.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/stores/UserStore.js') diff --git a/src/stores/UserStore.js b/src/stores/UserStore.js index 6e6f745c7..b652098f9 100644 --- a/src/stores/UserStore.js +++ b/src/stores/UserStore.js @@ -161,11 +161,11 @@ export default class UserStore extends Store { } @computed get isPremiumOverride() { - return (!this.team.plan && this.isPremium) || (this.team.state === 'expired' && this.isPremium); + return ((!this.team || !this.team.plan) && this.isPremium) || (this.team.state === 'expired' && this.isPremium); } @computed get isPersonal() { - if (!this.team.plan) return false; + if (!this.team || !this.team.plan) return false; const plan = getPlan(this.team.plan); return plan === PLANS.PERSONAL; @@ -174,7 +174,7 @@ export default class UserStore extends Store { @computed get isPro() { if (this.isPremiumOverride) return true; - if ((!this.team.plan || this.team.state === 'expired')) return false; + if (!this.team || (!this.team.plan || this.team.state === 'expired')) return false; const plan = getPlan(this.team.plan); return plan === PLANS.PRO || plan === PLANS.LEGACY; -- cgit v1.2.3-54-g00ecf