Skip to content

Commit

Permalink
Merge pull request #213 from appfolio/remove-lodash-over
Browse files Browse the repository at this point in the history
Remove lodash.over
  • Loading branch information
gthomas-appfolio authored May 12, 2017
2 parents eddda95 + 1b0957b commit b75cf7a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@
"lodash.flow": "^3.5.0",
"lodash.noop": "^3.0.1",
"lodash.omit": "^4.5.0",
"lodash.over": "^4.7.0",
"lodash.set": "^4.3.2",
"mocha": "~3.0.2",
"node-sass": "~3.10.0",
Expand Down
11 changes: 7 additions & 4 deletions src/components/Select.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import React, { Component } from 'react';
import ReactSelect from 'react-select';
import noop from 'lodash.noop';
import over from 'lodash.over';

// Disables CSS modules to import as global:
import './Select.scss';
Expand Down Expand Up @@ -75,16 +74,20 @@ class Select extends Component {
}
}

updateValue = value => { this.setState({ value }); }
onChange = value => {
this.setState({ value });
this.props.onChange(value);
}

render() {
const { value, onChange, ...props } = this.props;
const { value, ...props } = this.props;
delete props.onChange; // don't pass onChange prop to react-select
const SelectElement = this.props.loadOptions ? ReactSelect.Async : ReactSelect;

return (
<SelectElement
inputProps={{ ...props.inputProps, name: props.name || '' }}
onChange={over([this.updateValue, onChange])}
onChange={this.onChange}
value={value || this.state.value}
{...props}
ref={element => { monkeyPatchReactSelectGetFocusableOptionIndex(element); }}
Expand Down

0 comments on commit b75cf7a

Please sign in to comment.