1
0
mirror of https://github.com/ascribe/onion.git synced 2024-12-23 01:39:36 +01:00

bug fix for going to a piece when in a search

This commit is contained in:
Tim Daubenschütz 2015-10-13 17:30:49 +02:00
parent ea40181805
commit 3321379a8f

View File

@ -76,7 +76,7 @@ const SearchBar = React.createClass({
* *
* Like how it's being done in the 'Clear search' dialog. * Like how it's being done in the 'Clear search' dialog.
*/ */
if(this.props.searchQuery !== nextProps.searchQuery) { if(this.props.searchQuery !== nextProps.searchQuery || !this.state.searchQuery) {
this.setState({ searchQuery: nextProps.searchQuery }); this.setState({ searchQuery: nextProps.searchQuery });
} }
}, },
@ -117,7 +117,7 @@ const SearchBar = React.createClass({
render() { render() {
let searchIcon = <Glyphicon glyph='search' className="filter-glyph"/>; let searchIcon = <Glyphicon glyph='search' className="filter-glyph"/>;
const { className } = this.props; const { className } = this.props;
const { loading } = this.state; const { loading, searchQuery } = this.state;
if(loading) { if(loading) {
searchIcon = <span className="glyph-ascribe-spool-chunked ascribe-color spin"/>; searchIcon = <span className="glyph-ascribe-spool-chunked ascribe-color spin"/>;
@ -127,7 +127,7 @@ const SearchBar = React.createClass({
<span className={className}> <span className={className}>
<Input <Input
type='text' type='text'
value={this.state.searchQuery} value={searchQuery}
placeholder={getLangText('Search%s', '...')} placeholder={getLangText('Search%s', '...')}
onChange={this.handleChange} onChange={this.handleChange}
addonAfter={searchIcon} /> addonAfter={searchIcon} />