Skip to content

Commit

Permalink
refactor: clean code
Browse files Browse the repository at this point in the history
  • Loading branch information
NicolasAuger committed Apr 8, 2019
1 parent 32457e9 commit fd4d34c
Showing 1 changed file with 3 additions and 11 deletions.
14 changes: 3 additions & 11 deletions src/TagsField.js
Original file line number Diff line number Diff line change
Expand Up @@ -288,14 +288,7 @@ class TagsField extends React.Component {
}

onSelectTag(item) {
if (this.props.autoCompleteUniqueValues) {
if (!this.state.value.includes(item)) {
this.add(item);
}
} else {
this.add(item);
}

this.add(item);
this.setState({ opened: false });
}

Expand Down Expand Up @@ -328,8 +321,7 @@ class TagsField extends React.Component {
autoCompleteOptions,
} = this.state;

const listOptions = autoCompleteOptions || [];
const hasOptions = listOptions.length > 0;
const hasOptions = autoCompleteOptions.length > 0;

return (
<div
Expand Down Expand Up @@ -425,7 +417,7 @@ class TagsField extends React.Component {
animate={animateMenu}
>

{ listOptions.map((item, index) => (
{ autoCompleteOptions.map((item, index) => (
<DropdownItem
key={index}
>
Expand Down

0 comments on commit fd4d34c

Please sign in to comment.