Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Change translation from jp-JP to ja-JP - @gibkigonzo (#3824)
- Fixed ecosystem config for pm2 - @andrzejewsky (#3842)
- Fixed `mappingFallback` for extending modules - @andrzejewsky (#3822)
- Fixed some potential mutations of Config object in `catalog` and `catalog-next` - @grimasod (#3843)

### Changed / Improved
- Changed pre commit hook to use NODE_ENV production to check for debugger statements - @resubaka (#3686)
Expand Down
5 changes: 3 additions & 2 deletions core/modules/catalog-next/store/category/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import { preConfigureProduct } from '@vue-storefront/core/modules/catalog/helper
import chunk from 'lodash-es/chunk'
import Product from 'core/modules/catalog/types/Product';
import omit from 'lodash-es/omit'
import cloneDeep from 'lodash-es/cloneDeep'
import config from 'config'
import { parseCategoryPath } from '@vue-storefront/core/modules/breadcrumbs/helpers'

Expand Down Expand Up @@ -140,7 +141,7 @@ const actions: ActionTree<CategoryState, RootState> = {
categorySearchOptions.filters.id = searchedIds.filter(categoryId => !getters.getCategoriesMap[categoryId] && !getters.getNotFoundCategoryIds.includes(categoryId))
}
if (!searchingByIds || categorySearchOptions.filters.id.length) {
categorySearchOptions.filters = Object.assign(config.entities.category.filterFields, categorySearchOptions.filters)
categorySearchOptions.filters = Object.assign(cloneDeep(config.entities.category.filterFields), categorySearchOptions.filters ? cloneDeep(categorySearchOptions.filters) : {})
const categories = await CategoryService.getCategories(categorySearchOptions)
const notFoundCategories = searchedIds.filter(categoryId => !categories.some(cat => cat.id === parseInt(categoryId)))

Expand Down Expand Up @@ -176,7 +177,7 @@ const actions: ActionTree<CategoryState, RootState> = {
let resultFilters = aggregationFilters
const filtersKeys = Object.keys(filters)
if (categoryMappedFilters && filtersKeys.length) {
resultFilters = Object.assign({}, categoryMappedFilters, omit(aggregationFilters, filtersKeys))
resultFilters = Object.assign(cloneDeep(categoryMappedFilters), cloneDeep(omit(aggregationFilters, filtersKeys)))
}
commit(types.CATEGORY_SET_CATEGORY_FILTERS, {category, filters: resultFilters})
},
Expand Down
3 changes: 2 additions & 1 deletion core/modules/catalog/store/product/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import { optionLabel } from '../../helpers/optionLabel'
import { isOnline } from '@vue-storefront/core/lib/search'
import omit from 'lodash-es/omit'
import trim from 'lodash-es/trim'
import cloneDeep from 'lodash-es/cloneDeep'
import uniqBy from 'lodash-es/uniqBy'
import rootStore from '@vue-storefront/core/store'
import RootState from '@vue-storefront/core/types/RootState'
Expand Down Expand Up @@ -684,7 +685,7 @@ const actions: ActionTree<ProductState, RootState> = {
if (product && product.category_ids) {
let currentCategory = rootGetters['category-next/getCurrentCategory'] // use current category, if set
if (!currentCategory || !currentCategory.id || !product.category_ids.includes(currentCategory.id.toString())) {
const categoryFilters = Object.assign({ 'id': product.category_ids }, config.entities.category.breadcrumbFilterFields)
const categoryFilters = Object.assign({ 'id': [...product.category_ids] }, cloneDeep(config.entities.category.breadcrumbFilterFields))
const categories = await dispatch('category-next/loadCategories', {filters: categoryFilters}, { root: true })
currentCategory = categories.sort((a, b) => (a.level > b.level) ? -1 : 1)[0] // sort starting by deepest level
}
Expand Down