Skip to content

Commit

Permalink
fix(refinementList): singleRefine is not dependant from operator
Browse files Browse the repository at this point in the history
  • Loading branch information
vvo committed Oct 5, 2015
1 parent 2b049c5 commit d29dff6
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions widgets/refinement-list.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,11 @@ function refinementList({
throw new Error(usage);
}

operator = operator.toLowerCase();
if (operator !== 'and' && operator !== 'or') {
throw new Error(usage);
if (operator) {
operator = operator.toLowerCase();
if (operator !== 'and' && operator !== 'or') {
throw new Error(usage);
}
}

return {
Expand Down Expand Up @@ -103,7 +105,12 @@ function refinementList({

function toggleRefinement(helper, singleRefine, facetName, facetValue) {
if (singleRefine) {
helper.clearRefinement(facetName);
var previousRefinement = helper.getRefinements(facetName);
helper.clearRefinements(facetName);
if (previousRefinement && previousRefinement[0] && previousRefinement[0].value === facetValue) {
helper.search();
return;
}
}

helper
Expand Down

0 comments on commit d29dff6

Please sign in to comment.