From 29e0d121cda50720438c0e216346413ad0dcb914 Mon Sep 17 00:00:00 2001 From: Sosuke Suzuki Date: Sun, 11 Jun 2017 15:42:07 +0900 Subject: [PATCH] improve searchTextBox ux --- browser/main/NoteList/index.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/browser/main/NoteList/index.js b/browser/main/NoteList/index.js index d0273a7f7..feccd3aff 100644 --- a/browser/main/NoteList/index.js +++ b/browser/main/NoteList/index.js @@ -203,6 +203,7 @@ class NoteList extends React.Component { getNotes () { let { data, params, location } = this.props + let { router } = this.context if (location.pathname.match(/\/home/)) { return data.noteMap.map((note) => note) @@ -214,7 +215,11 @@ class NoteList extends React.Component { } if (location.pathname.match(/\/searched/)) { - return searchFromNotes(this.props.data, document.getElementsByClassName('searchInput')[0].value) + const searchInputText = document.getElementsByClassName('searchInput')[0].value + if (searchInputText === '') { + router.push('/home') + } + return searchFromNotes(this.props.data, searchInputText) } let storageKey = params.storageKey