Skip to content

Commit

Permalink
Updated bundle
Browse files Browse the repository at this point in the history
  • Loading branch information
tbleckert committed Jun 3, 2020
1 parent 91ce907 commit 309089f
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
9 changes: 8 additions & 1 deletion dist/cjs/useSelect.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,14 @@ function useSelectSearch(_ref) {

var onSelect = (0, _react.useCallback)(function (val) {
setState(function (oldState) {
var item = val || oldState.flat[oldState.highlighted].value;
var defaultItem = oldState.flat[oldState.highlighted];
var oldStateValue = defaultItem && defaultItem.value;
var item = val || oldStateValue;

if (!item) {
return oldState;
}

var values = (0, _getNewValue["default"])(item, oldState.value, multiple);
var newOptions = (0, _getOption["default"])(values, oldState.flat);
return _objectSpread(_objectSpread({}, oldState), {}, {
Expand Down
9 changes: 8 additions & 1 deletion dist/esm/useSelect.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,14 @@ export default function useSelectSearch({

const onSelect = useCallback(val => {
setState(oldState => {
const item = val || oldState.flat[oldState.highlighted].value;
const defaultItem = oldState.flat[oldState.highlighted];
const oldStateValue = defaultItem && defaultItem.value;
const item = val || oldStateValue;

if (!item) {
return oldState;
}

const values = getNewValue(item, oldState.value, multiple);
const newOptions = getOption(values, oldState.flat);
return _objectSpread(_objectSpread({}, oldState), {}, {
Expand Down

1 comment on commit 309089f

@vercel
Copy link

@vercel vercel bot commented on 309089f Jun 3, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.