From 7e9d01d2eebc0f42dbc3004d3a3e4ffbff4574b8 Mon Sep 17 00:00:00 2001 From: naman-contentstack Date: Mon, 9 Dec 2024 18:30:15 +0530 Subject: [PATCH] DX-1781, added optional chaining --- packages/contentstack-variants/src/import/experiences.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/contentstack-variants/src/import/experiences.ts b/packages/contentstack-variants/src/import/experiences.ts index 52479d7f18..c0bf9eb400 100644 --- a/packages/contentstack-variants/src/import/experiences.ts +++ b/packages/contentstack-variants/src/import/experiences.ts @@ -238,7 +238,8 @@ export default class Experiences extends PersonalizationAdapter { try { const promises = this.pendingVariantAndVariantGrpForExperience.map(async (expUid) => { const expRes = await this.getExperience(expUid); - if (expRes?._cms && expRes?._cms?.variantGroup && Object.keys(expRes._cms.variants).length > 0) { + const variants = expRes?._cms?.variants ?? {}; + if (expRes?._cms && expRes?._cms?.variantGroup && Object.keys(variants).length > 0) { this.cmsVariants[expUid] = expRes._cms?.variants ?? {}; this.cmsVariantGroups[expUid] = expRes._cms?.variantGroup ?? {}; return expUid; // Return the expUid for filtering later