From e7af5ee5ca402f7c637586831d611e5648cbc5b9 Mon Sep 17 00:00:00 2001 From: Daniel Kos Date: Tue, 30 Oct 2018 13:48:11 +0100 Subject: [PATCH] Fix setting autocomplete view first item Feature #14364 Arvados-DCO-1.1-Signed-off-by: Daniel Kos --- src/store/search-bar/search-bar-actions.ts | 2 +- src/store/search-bar/search-bar-reducer.ts | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/store/search-bar/search-bar-actions.ts b/src/store/search-bar/search-bar-actions.ts index eb4239de7a..165392c6c2 100644 --- a/src/store/search-bar/search-bar-actions.ts +++ b/src/store/search-bar/search-bar-actions.ts @@ -32,7 +32,7 @@ export const searchBarActions = unionize({ MOVE_UP: ofType<{}>(), MOVE_DOWN: ofType<{}>(), SELECT_FIRST_ITEM: ofType<{}>() -}); +}); export type SearchBarActions = UnionOf; diff --git a/src/store/search-bar/search-bar-reducer.ts b/src/store/search-bar/search-bar-reducer.ts index 32b01f726a..8508c05d04 100644 --- a/src/store/search-bar/search-bar-reducer.ts +++ b/src/store/search-bar/search-bar-reducer.ts @@ -127,9 +127,7 @@ export const searchBarReducer = (state = initialState, action: SearchBarActions) SELECT_FIRST_ITEM: () => { let selectedItem = state.selectedItem; if (state.currentView === SearchView.AUTOCOMPLETE) { - if (state.searchResults.length > 0) { - selectedItem = makeSelectedItem(state.searchResults[0].uuid); - } + selectedItem = makeSelectedItem(state.searchValue); } else if (state.currentView === SearchView.BASIC) { const items = makeQueryList(state.recentQueries, state.savedQueries); if (items.length > 0) { -- 2.39.5