diff --git a/browser/render/layouts/list-and-detail/search-snippet-bar/index.jsx b/browser/render/layouts/list-and-detail/search-snippet-bar/index.jsx index c0d0207..bdbe59c 100644 --- a/browser/render/layouts/list-and-detail/search-snippet-bar/index.jsx +++ b/browser/render/layouts/list-and-detail/search-snippet-bar/index.jsx @@ -7,13 +7,17 @@ export default class SearchSnippetBar extends React.Component { componentDidMount () { eventEmitter.on('languageList:pickLang', (event, language) => { const newKeyword = `lang:${language}` - this.refs.search.value = newKeyword + if (this.refs.search) { + this.refs.search.value = newKeyword + } this.handleSearch(newKeyword) }) eventEmitter.on('taglist:pickTag', (event, tag) => { const newKeyword = `#${tag}` - this.refs.search.value = newKeyword + if (this.refs.search) { + this.refs.search.value = newKeyword + } this.handleSearch(newKeyword) }) } diff --git a/browser/render/layouts/original/search-snippet-bar/index.jsx b/browser/render/layouts/original/search-snippet-bar/index.jsx index a6b3dc9..8de3e6f 100644 --- a/browser/render/layouts/original/search-snippet-bar/index.jsx +++ b/browser/render/layouts/original/search-snippet-bar/index.jsx @@ -8,13 +8,17 @@ export default class SearchSnippetBar extends React.Component { componentDidMount () { eventEmitter.on('languageList:pickLang', (event, language) => { const newKeyword = `lang:${language}` - this.refs.search.value = newKeyword + if (this.refs.search) { + this.refs.search.value = newKeyword + } this.handleSearch(newKeyword) }) eventEmitter.on('taglist:pickTag', (event, tag) => { const newKeyword = `#${tag}` - this.refs.search.value = newKeyword + if (this.refs.search) { + this.refs.search.value = newKeyword + } this.handleSearch(newKeyword) }) }