diff --git a/README.md b/README.md index 314e9893..e9c4660d 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ Powered by [Algolia search API](https://www.algolia.com/), [npm-suggestions](https://github.com/JureSotosek/npm-suggestions) and the [Yarn](http://yarnpkg.com/) package manager. -

+

## Overview diff --git a/media/example.gif b/media/example.gif deleted file mode 100644 index 1e2607ac..00000000 Binary files a/media/example.gif and /dev/null differ diff --git a/media/newExample.gif b/media/newExample.gif new file mode 100644 index 00000000..c4b25da5 Binary files /dev/null and b/media/newExample.gif differ diff --git a/src/emma.js b/src/emma.js index a54dbc09..add5911c 100755 --- a/src/emma.js +++ b/src/emma.js @@ -128,13 +128,7 @@ const SelectedPackages = ({ selectedPackages }) => ( // Restults -const SearchResults = ({ - foundPackages, - onToggle, - loading, - loadingBackground, - focused, -}) => { +const SearchResults = ({ foundPackages, onToggle, loading, focused }) => { if (loading === PROGRESS_LOADING) { return (
@@ -150,7 +144,7 @@ const SearchResults = ({ return } - if (isEmpty(foundPackages) && !loadingBackground) { + if (isEmpty(foundPackages)) { return } @@ -252,7 +246,6 @@ class Emma extends Component { foundSuggestionsPackages, selectedPackages, loadingSearch, - loadingSearchBackground, loadingSuggestions, focused, } = this.state @@ -271,7 +264,6 @@ class Emma extends Component { foundPackages={foundSearchPackages} onToggle={this.handleTogglePackage} loading={loadingSearch} - loadingBackground={loadingSearchBackground} focused={focused === FOCUSED_SEARCH} /> )} @@ -368,28 +360,28 @@ class Emma extends Component { }) setTimeout(() => { - if (this.state.loadingSearchBackground) { + if (this.state.loadingSearchBackground && this.state.query == query) { this.setState({ loadingSearch: PROGRESS_LOADING, loadingSearchBackground: false, }) } - }, 1500) + }, 500) try { const hits = await getSearch(query, limit) const cells = hitsToCells(hits) - this.setState({ - loadingSearch: PROGRESS_LOADED, - loadingSearchBackground: false, - }) - if (this.state.query === query) { this.setState({ foundSearchPackages: cells, }) } + + this.setState({ + loadingSearch: PROGRESS_LOADED, + loadingSearchBackground: false, + }) } catch (err) { this.setState({ loadingSearchBackground: PROGRESS_ERROR,