From e1bb3d65480bd9758439fa4fabb6ef7a0f405a5e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Mierzwa?= Date: Thu, 30 Aug 2018 21:09:43 +0100 Subject: [PATCH] refactor(ui): store suggestion fetch result so we can use it in tests --- ui/src/Components/NavBar/FilterInput/index.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ui/src/Components/NavBar/FilterInput/index.js b/ui/src/Components/NavBar/FilterInput/index.js index fb075f9ec..430c8ab98 100644 --- a/ui/src/Components/NavBar/FilterInput/index.js +++ b/ui/src/Components/NavBar/FilterInput/index.js @@ -31,6 +31,7 @@ const FilterInput = observer( { ref: null, suggestions: [], + suggestionsFetch: null, value: "", storeInputReference(ref) { this.ref = ref; @@ -70,7 +71,9 @@ const FilterInput = observer( onSuggestionsFetchRequested = debounce( action(({ value }) => { if (value !== "") { - fetch(FormatUnseeBackendURI(`autocomplete.json?term=${value}`)) + this.inputStore.suggestionsFetch = fetch( + FormatUnseeBackendURI(`autocomplete.json?term=${value}`) + ) .then( result => result.json(), err => {