Skip to content

Commit

Permalink
fix(numericSelector): if no currentValue found, use the first option
Browse files Browse the repository at this point in the history
  • Loading branch information
vvo committed Aug 29, 2016
1 parent e9f6ff7 commit ef56dfa
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ describe('numericSelector()', () => {
root: 'ais-numeric-selector custom-root cx',
item: 'ais-numeric-selector--item custom-item'
},
currentValue: undefined,
currentValue: 1,
shouldAutoHideContainer: true,
options: [
{value: 1, label: 'first'},
Expand Down
4 changes: 2 additions & 2 deletions src/widgets/numeric-selector/numeric-selector.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ function numericSelector({

return {
init({helper}) {
const currentValue = this._getRefinedValue(helper) || options[0].value;
const currentValue = this._getRefinedValue(helper);
if (currentValue !== undefined) {
helper.addNumericRefinement(attributeName, operator, currentValue);
}
Expand Down Expand Up @@ -92,7 +92,7 @@ function numericSelector({
const refinedValue = find(refinements, {operator});
return refinedValue &&
refinedValue.value !== undefined &&
refinedValue.value[0] !== undefined ? refinedValue.value[0] : undefined;
refinedValue.value[0] !== undefined ? refinedValue.value[0] : options[0].value;
}
};
}
Expand Down

0 comments on commit ef56dfa

Please sign in to comment.