From 2487a314f59d88a2a48852e519d9bc158f54c5f1 Mon Sep 17 00:00:00 2001 From: Rishabh Date: Fri, 18 Nov 2022 14:31:35 +0530 Subject: [PATCH] Added guard for missing portal plans in portal site data refs https://github.com/TryGhost/Team/issues/2276 Portal died with an unintelligible error about portal plans/includes being undefined when there was another react error on the page. The other error somehow caused the `site` data to be empty object for Portal, and there was one place where we didn't check for the empty object while transforming the site data which caused the failure. This change adds the guard for failing check so we don't throw the error in such cases and process as normal. --- ghost/portal/src/utils/helpers.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ghost/portal/src/utils/helpers.js b/ghost/portal/src/utils/helpers.js index 0e88f41453..0b09114720 100644 --- a/ghost/portal/src/utils/helpers.js +++ b/ghost/portal/src/utils/helpers.js @@ -288,7 +288,7 @@ export function transformApiSiteData({site}) { } // self signup must be available for free plan signup to work - if (site.portal_plans.includes('free')) { + if (site.portal_plans?.includes('free')) { site.allow_self_signup = true; }