From cfa72b080e59030fb1ffba963328c2ea7c60b32b Mon Sep 17 00:00:00 2001 From: tniezg Date: Wed, 28 Jul 2021 17:12:52 +0200 Subject: [PATCH] Fix option values collection --- framework/spree/utils/expandOptions.ts | 11 ++++++++++- framework/spree/utils/getMediaGallery.ts | 2 +- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/framework/spree/utils/expandOptions.ts b/framework/spree/utils/expandOptions.ts index 455354608..105f7d947 100644 --- a/framework/spree/utils/expandOptions.ts +++ b/framework/spree/utils/expandOptions.ts @@ -73,8 +73,17 @@ const expandOptions = ( } } - const expandedOptionValues = [...option.values, optionValue] + if (existingOptionIndex === -1) { + return [ + ...accumulatedOptions, + { + ...option, + values: [optionValue], + }, + ] + } + const expandedOptionValues = [...option.values, optionValue] const expandedOptions = [...accumulatedOptions] expandedOptions[existingOptionIndex] = { diff --git a/framework/spree/utils/getMediaGallery.ts b/framework/spree/utils/getMediaGallery.ts index fe5587aa2..e697562d4 100644 --- a/framework/spree/utils/getMediaGallery.ts +++ b/framework/spree/utils/getMediaGallery.ts @@ -12,7 +12,7 @@ const getMediaGallery = ( ) => string | null ) => { return images.reduce((productImages, _, imageIndex) => { - const imageUrl = getImageUrl(images[imageIndex], 9001, 9001) + const imageUrl = getImageUrl(images[imageIndex], 800, 800) if (imageUrl) { return [