Merge "UI: reset search session data if empty result."

This commit is contained in:
mpl 2014-03-21 13:11:13 +00:00 committed by Gerrit Code Review
commit 3d7c093ac8
2 changed files with 7 additions and 3 deletions

View File

@ -138,9 +138,6 @@ cam.BlobItemContainerReact = React.createClass({
this.childProps_ = [];
var results = this.props.searchSession.getCurrentResults();
if (!results || !results.blobs || results.blobs.length == 0) {
return;
}
var data = goog.array.map(results.blobs, function(blob) {
return new cam.BlobItemReactData(blob.blob, results.description.meta);
});

View File

@ -76,6 +76,10 @@ cam.SearchSession.prototype.getQuery = function() {
}
// Returns all the data we currently have loaded.
// It is guaranteed to return the following properties:
// blobs // non-zero length
// description
// description.meta
cam.SearchSession.prototype.getCurrentResults = function() {
return this.data_;
};
@ -154,6 +158,9 @@ cam.SearchSession.prototype.searchDone_ = function(changeType, result) {
this.data_.blobs = result.blobs;
this.data_.description = result.description;
}
if (!this.data_.blobs || this.data_.blobs.length == 0) {
this.resetData_();
}
if (result.continue) {
this.continuation_ = this.getContinuation_(this.constructor.SEARCH_SESSION_CHANGE_TYPE.APPEND, result.continue);