Merge pull request #72 from gaearon/search-bug

Don't move selection unless search text increased length
This commit is contained in:
Brian Vaughn
2019-04-04 17:55:12 -07:00
committed by GitHub
+4 -4
View File
@@ -309,10 +309,10 @@ function reduceSearchState(store: Store, state: State, action: Action): State {
}
// Changes in search index or typing should override the selected element.
if (
searchIndex !== prevSearchIndex ||
searchText.indexOf(prevSearchText) === 0
) {
const didAddToSearchText =
searchText.length > prevSearchText.length &&
searchText.indexOf(prevSearchText) === 0;
if (searchIndex !== prevSearchIndex || didAddToSearchText) {
if (searchIndex === null) {
selectedElementIndex = null;
selectedElementID = null;