Fix refreshing behavior on new input in WunderBar
Before, <WunderBar /> would compare the address inside it to the page address passed in by <Header /> to determine if there was a page change. This would cause user input to be replaced with "Home" when typing a search, since during a search the page address is always "Home," not the query. Now it simply checks if the page being viewed has changed.
This commit is contained in:
parent
e42252507b
commit
a82ee8a2d5
1 changed files with 2 additions and 2 deletions
|
@ -34,7 +34,7 @@ var Header = React.createClass({
|
|||
<Link href="?discover" button="alt button--flat" icon="icon-home" />
|
||||
</div>
|
||||
<div className="header__item header__item--wunderbar">
|
||||
<WunderBar address={this.props.address} icon={this.props.wunderBarIcon} onSearch={this.props.onSearch} />
|
||||
<WunderBar address={this.props.address} icon={this.props.wunderBarIcon} onSearch={this.props.onSearch} viewingPage={this.props.viewingPage} />
|
||||
</div>
|
||||
<div className="header__item">
|
||||
<Link href="?wallet" button="text" icon="icon-bank" label={lbry.formatCredits(this.state.balance, 1)} ></Link>
|
||||
|
@ -86,7 +86,7 @@ let WunderBar = React.createClass({
|
|||
|
||||
},
|
||||
componentWillReceiveProps(nextProps) {
|
||||
if (nextProps.address !== this.state.address || nextProps.icon !== this.state.icon) {
|
||||
if (nextProps.viewingPage !== this.props.viewingPage) {
|
||||
this.setState({ address: nextProps.address, icon: nextProps.icon });
|
||||
}
|
||||
},
|
||||
|
|
Loading…
Reference in a new issue