From c1df8366fb3bd8e02c7a9d7019d423235c504bbc Mon Sep 17 00:00:00 2001 From: Rishabh Date: Wed, 9 Jun 2021 09:21:52 +0530 Subject: [PATCH] Filtered empty prices from list no refs Handles empty price objects in the API and ignores them from UI --- ghost/portal/src/utils/helpers.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/ghost/portal/src/utils/helpers.js b/ghost/portal/src/utils/helpers.js index 476adc6542..753c1c6535 100644 --- a/ghost/portal/src/utils/helpers.js +++ b/ghost/portal/src/utils/helpers.js @@ -173,7 +173,9 @@ export function getAvailablePrices({site = {}, includeFree = true} = {}) { const plansData = []; - const stripePrices = prices.map((d) => { + const stripePrices = prices.filter((d) => { + return !!(d && d.id); + }).map((d) => { return { ...d, price_id: d.id, @@ -218,7 +220,9 @@ export function getSitePrices({site = {}, includeFree = true, pageQuery = ''} = const plansData = []; - const stripePrices = prices.map((d) => { + const stripePrices = prices.filter((d) => { + return !!(d && d.id); + }).map((d) => { return { ...d, price_id: d.id,