From b5994839495475a48a27e28587b3151267853034 Mon Sep 17 00:00:00 2001 From: cewald Date: Sun, 19 Apr 2020 08:50:46 +0000 Subject: [PATCH 1/3] Bugfix for reactivity of `current_configuration` in `populateProductConfigurationAsync` --- core/modules/catalog/helpers/index.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/core/modules/catalog/helpers/index.ts b/core/modules/catalog/helpers/index.ts index 5bdaaaa8ed..71d18373ce 100644 --- a/core/modules/catalog/helpers/index.ts +++ b/core/modules/catalog/helpers/index.ts @@ -1,3 +1,4 @@ +import Vue from 'vue' import EventBus from '@vue-storefront/core/compatibility/plugins/event-bus' import rootStore from '@vue-storefront/core/store' import flattenDeep from 'lodash-es/flattenDeep' @@ -5,7 +6,6 @@ import omit from 'lodash-es/omit' import remove from 'lodash-es/remove' import toString from 'lodash-es/toString' import union from 'lodash-es/union' -import isObject from 'lodash-es/union' // TODO: Remove this dependency import { optionLabel } from './optionLabel' import i18n from '@vue-storefront/i18n' @@ -474,7 +474,8 @@ export function populateProductConfigurationAsync (context, { product, selectedV id: selectedOption.value, label: selectedOption.label ? selectedOption.label : /* if not set - find by attribute */optionLabel(context.rootState.attribute, { attributeKey: selectedOption.attribute_code, searchBy: 'code', optionId: selectedOption.value }) } - context.state.current_configuration[attribute_code] = confVal + const conf = Object.assign({}, context.state.current_configuration, { [attribute_code]: confVal }) + Vue.set(context.state, 'current_configuration', conf) } if (config.cart.setConfigurableProductOptions) { const productOption = setConfigurableProductOptionsAsync(context, { product: product, configuration: context.state.current_configuration }) // set the custom options From 1319067c4a6084c6b582580e5871efd5adf321f6 Mon Sep 17 00:00:00 2001 From: cewald Date: Sun, 19 Apr 2020 08:58:32 +0000 Subject: [PATCH 2/3] Update CHANGELOG.md --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3ae774a0be..812235f56f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -53,6 +53,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Use `setProductGallery` in `product/setCurrent` to use logic of the action - @cewald (#4153) - Use same data format in getConfigurationMatchLevel - @gibkigonzo (#4208) - removed possible memory leak in ssr - @resubaka (#4247) +- Bugfix for reactivity of `current_configuration` in `populateProductConfigurationAsync` - @cewald (#4258) ### Changed / Improved From 9e5ed44d29de1755f574a36a6a317775d440a29c Mon Sep 17 00:00:00 2001 From: cewald Date: Wed, 22 Apr 2020 13:46:23 +0000 Subject: [PATCH 3/3] Improve state update in `populateProductConfigurationAsync` --- core/modules/catalog/helpers/index.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/core/modules/catalog/helpers/index.ts b/core/modules/catalog/helpers/index.ts index 71d18373ce..76ac66edd1 100644 --- a/core/modules/catalog/helpers/index.ts +++ b/core/modules/catalog/helpers/index.ts @@ -474,8 +474,7 @@ export function populateProductConfigurationAsync (context, { product, selectedV id: selectedOption.value, label: selectedOption.label ? selectedOption.label : /* if not set - find by attribute */optionLabel(context.rootState.attribute, { attributeKey: selectedOption.attribute_code, searchBy: 'code', optionId: selectedOption.value }) } - const conf = Object.assign({}, context.state.current_configuration, { [attribute_code]: confVal }) - Vue.set(context.state, 'current_configuration', conf) + Vue.set(context.state.current_configuration, attribute_code, confVal) } if (config.cart.setConfigurableProductOptions) { const productOption = setConfigurableProductOptionsAsync(context, { product: product, configuration: context.state.current_configuration }) // set the custom options