Skip to content

Commit

Permalink
fix(bugs): Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
maticzav committed Mar 15, 2018
1 parent c966173 commit a08990d
Showing 1 changed file with 12 additions and 16 deletions.
28 changes: 12 additions & 16 deletions src/emma.js
Original file line number Diff line number Diff line change
Expand Up @@ -179,15 +179,11 @@ class Emma extends Component {
this.handleQueryChange = this.handleQueryChange.bind(this)
this.handleInstall = this.handleInstall.bind(this)
this.handleTogglePackage = this.handleTogglePackage.bind(this)
this.handleKeyPress = this.handleKeyPress.bind(this)
}

render() {
const {
query,
foundPackages,
selectedPackages,
loading
} = this.state
const { query, foundPackages, selectedPackages, loading } = this.state

return (
<div>
Expand All @@ -208,9 +204,7 @@ class Emma extends Component {
/>
)}
{notEmpty(selectedPackages) && (
<SelectedPackages
selectedPackages={selectedPackages}
/>
<SelectedPackages selectedPackages={selectedPackages}/>
)}
</div>
)
Expand Down Expand Up @@ -268,14 +262,20 @@ class Emma extends Component {
return
}

const exists = selectedPackages.some(({ objectID }) => objectID === pkg.objectID)
const exists = selectedPackages.some(
({ objectID }) => objectID === pkg.objectID
)

if (exists) {
this.setState({
selectedPackages: selectedPackages.filter(({ objectID }) => objectID !== pkg.objectID)
query: '',
selectedPackages: selectedPackages.filter(
({ objectID }) => objectID !== pkg.objectID
)
})
} else {
this.setState({
query: '',
selectedPackages: [...selectedPackages, pkg]
})
}
Expand All @@ -301,11 +301,7 @@ class Emma extends Component {

// Packages
const packages = selectedPackages.map(pkg => pkg.name)
const args = [
arg,
...packages,
...(isDev ? [devArg] : [])
]
const args = [arg, ...packages, ...(isDev ? [devArg] : [])]

// Install the queries

Expand Down

0 comments on commit a08990d

Please sign in to comment.