Fix regression in navigation to non-image file.

Before the initial click would yield an empty page, and you'd have
to refresh to see anything.

Change-Id: Ic26915aa26e4d9285e72ae7fa856283ee6790922
This commit is contained in:
Aaron Boodman 2014-02-11 06:39:30 -08:00
parent b0775e03e9
commit 64f1d810b8
1 changed files with 11 additions and 7 deletions

View File

@ -159,6 +159,10 @@ cam.IndexPageReact = React.createClass({
}
}
if (!this.isSearchMode_(newURL) && !this.isDetailMode_(newURL)) {
return false;
}
this.updateSearchSession_(newURL);
this.setState({currentURL: newURL});
return true;
@ -187,7 +191,7 @@ cam.IndexPageReact = React.createClass({
},
getNav_: function() {
if (!this.inSearchMode_()) {
if (!this.isSearchMode_(this.state.currentURL)) {
return null;
}
return cam.NavReact({key:'nav', ref:'nav', timer:this.props.timer, open:this.state.isNavOpen, onOpen:this.handleNavOpen_, onClose:this.handleNavClose_}, [
@ -352,19 +356,19 @@ cam.IndexPageReact = React.createClass({
this.setState({selection:newSelection});
},
inSearchMode_: function() {
isSearchMode_: function(url) {
// This is super finicky. We should improve the URL scheme and give things that are different different paths.
var query = this.state.currentURL.getQueryData();
var query = url.getQueryData();
return query.getCount() == 0 || (query.getCount() == 1 && query.containsKey('q'));
},
inDetailMode_: function() {
var query = this.state.currentURL.getQueryData();
isDetailMode_: function(url) {
var query = url.getQueryData();
return query.containsKey('p') && query.get('newui') == '1';
},
getBlobItemContainer_: function() {
if (!this.inSearchMode_()) {
if (!this.isSearchMode_(this.state.currentURL)) {
return null;
}
@ -410,7 +414,7 @@ cam.IndexPageReact = React.createClass({
},
getDetailView_: function() {
if (!this.inDetailMode_()) {
if (!this.isDetailMode_(this.state.currentURL)) {
return null;
}