Skip to content

Commit

Permalink
feat!: use config utils (facets)
Browse files Browse the repository at this point in the history
BREAKING CHANGE: setFacetsConfig mutation has been renamed/replaced by setConfig

EMP-2328
  • Loading branch information
annacv committed Oct 11, 2023
1 parent 7c69eb7 commit a71eeb9
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ describe('testing facets module getters', () => {
);

const store = createFacetsStore([parentFilter, childFilter, parentFilterWithoutChild], []);
store.commit('setFacetsConfig', {
store.commit('setConfig', {
filtersStrategyForRequest: 'leaves-only'
});

Expand Down
12 changes: 5 additions & 7 deletions packages/x-components/src/x-modules/facets/store/module.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import { Facet } from '@empathyco/x-types';
import Vue from 'vue';
import { setConfig } from '../../../store/utils/config-store.utils';
import { setQuery } from '../../../store/utils/query.utils';
import { facets } from './getters/facets.getter';
import { selectedFiltersByFacet } from './getters/selected-filters-by-facet.getter';
import { selectedFilters } from './getters/selected-filters.getter';
import { FacetGroupEntry, FacetsConfig, FacetsXStoreModule } from './types';
import { FacetGroupEntry, FacetsXStoreModule } from './types';
import { selectedFiltersForRequest } from './getters/selected-filters-for-request.getter';

/**
Expand Down Expand Up @@ -55,12 +57,8 @@ export const facetsXStoreModule: FacetsXStoreModule = {
setFacet(state, facet: Facet) {
Vue.set(state.facets, facet.id, facet);
},
setFacetsConfig(state, config: FacetsConfig) {
state.config = config;
},
setQuery(state, query) {
state.query = query;
},
setConfig,
setQuery,
setStickyFilter(state, filter) {
if (!state.stickyFilters[filter.id]) {
Vue.set(state.stickyFilters, filter.id, filter);
Expand Down
2 changes: 1 addition & 1 deletion packages/x-components/src/x-modules/facets/store/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ export interface FacetsMutations {
*
* @param config - The new config.
*/
setFacetsConfig(config: FacetsConfig): void;
setConfig(config: FacetsConfig): void;
/**
* Adds the filter to the {@link FacetsState.stickyFilters | sticky filters} record.
*
Expand Down

0 comments on commit a71eeb9

Please sign in to comment.