From 6830f15ac4d5ed9abfdaf7af67253379fa49cb1c Mon Sep 17 00:00:00 2001 From: Hunter Leachman Date: Thu, 14 Jan 2021 11:47:11 -0600 Subject: [PATCH] fix:(STRF-8909) theme variation not applied with activate flag (#679) --- lib/stencil-push.utils.js | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/lib/stencil-push.utils.js b/lib/stencil-push.utils.js index 18f118ba..3446f5d3 100644 --- a/lib/stencil-push.utils.js +++ b/lib/stencil-push.utils.js @@ -298,22 +298,25 @@ utils.getVariations = async (options) => { storeHash, }); - if (!activate && activate !== undefined) { + // Activate the default variation + if (activate === true) { + return { ...options, variationId: variations[0].uuid }; + } + // Activate the specified variation + if (activate !== undefined) { const foundVariation = variations.find((item) => item.name === activate); if (!foundVariation || !foundVariation.uuid) { const availableOptionsStr = variations.map((item) => `${item.name}`).join(', '); throw new Error( - `Invalid theme variation provided!. Available options ${availableOptionsStr}...`, + `Invalid theme variation provided! Available options: ${availableOptionsStr}.`, ); } return { ...options, variationId: foundVariation.uuid }; } - if (activate) { - return { ...options, variationId: variations[0].uuid }; - } + // Didn't specify a variation explicitly, will ask the user later return { ...options, variations }; };