Skip to content

Commit

Permalink
Correctly set cf-facetId when selecting category facet search result …
Browse files Browse the repository at this point in the history
  • Loading branch information
fbeaudoincoveo committed Feb 19, 2025
1 parent ed12109 commit ce59cc4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -630,23 +630,23 @@ describe('commerceParameters slice', () => {
);
expect(finalState.page).toBeUndefined();
});
it('sets state.cf[payload.facetId] to payload.value.path', () => {
it('sets state.cf[payload.facetId] to [...payload.value.path, payload.value.rawValue]', () => {
const finalState = parametersReducer(
state,
selectCategoryFacetSearchResult({
facetId: 'facetId2',
value: {
path: ['f2v1', 'f2v2'],
count: 1,
displayValue: 'f2v2',
rawValue: 'f2v2',
displayValue: 'F2V3',
rawValue: 'f2v3',
},
})
);

expect(finalState).toEqual({
...state,
cf: {facetId1: ['f1v1'], facetId2: ['f2v1', 'f2v2']},
cf: {facetId1: ['f1v1'], facetId2: ['f2v1', 'f2v2', 'f2v3']},
});
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ const handleSelectCategoryFacetSearchResult = (
state.page = undefined;

state.cf ??= {};
state.cf[payload.facetId] = payload.value.path;
state.cf[payload.facetId] = [...payload.value.path, payload.value.rawValue];
};

const handleToggleSelectFacetValue = (
Expand Down

0 comments on commit ce59cc4

Please sign in to comment.