Fix duplicate calls to search API

TNL-3198

Also fixed a regression with the search breadcrumbs
where it wasn't possible to navigate back to the
full list.
This commit is contained in:
Andy Armstrong
2015-09-14 12:18:11 -04:00
parent 0a434e4388
commit f80b6221d9
8 changed files with 108 additions and 66 deletions

View File

@@ -90,16 +90,20 @@
*/
setPage: function (page) {
var oldPage = this.currentPage,
self = this;
return this.goTo(page - (this.isZeroIndexed ? 1 : 0), {reset: true}).then(
self = this,
deferred = $.Deferred();
this.goTo(page - (this.isZeroIndexed ? 1 : 0), {reset: true}).then(
function () {
self.isStale = false;
self.trigger('page_changed');
deferred.resolve();
},
function () {
self.currentPage = oldPage;
deferred.fail();
}
);
return deferred.promise();
},