@samitouri / QOS-React / commits / a8e46c67e6

Don't move selection unless search text increased length

Dan committed Apr 5, 2019 at 00:49 UTC a8e46c67e67691813f130d72d097fc8ba542dea2
1 file changed +4 -4
src/devtools/views/Components/TreeContext.js
+4 -4
@@ -309,10 +309,10 @@ function reduceSearchState(store: Store, state: State, action: Action): State {
309 }
310
311 // Changes in search index or typing should override the selected element.
312 - if (
313 - searchIndex !== prevSearchIndex ||
314 - searchText.indexOf(prevSearchText) === 0
315 - ) {
312 + const didAddToSearchText =
313 + searchText.length > prevSearchText.length &&
314 + searchText.indexOf(prevSearchText) === 0;
315 + if (searchIndex !== prevSearchIndex || didAddToSearchText) {
316 if (searchIndex === null) {
317 selectedElementIndex = null;
318 selectedElementID = null;