Don't load albums / photos for old path request
Signed-off-by: James Ketrenos <james_git@ketrenos.com>
This commit is contained in:
parent
d5cf769e8c
commit
e9a9142f87
@ -734,9 +734,17 @@
|
||||
query += key + "=" + encodeURIComponent(params[key]);
|
||||
}
|
||||
|
||||
var path = this.path || "";
|
||||
console.log("Requesting " + this.limit + " photos.");
|
||||
window.fetch("api/v1/photos" + (this.path || "") + query, function(error, xhr) {
|
||||
window.fetch("api/v1/photos" + path + query, function(path, error, xhr) {
|
||||
this.loading = false;
|
||||
|
||||
if (path != (this.path || "")) {
|
||||
console.log("Skipping results for old query. Triggering re-fetch of photos for new path.");
|
||||
this._loadPhotos();
|
||||
return;
|
||||
}
|
||||
|
||||
if (error) {
|
||||
console.error(JSON.stringify(error, null, 2));
|
||||
return;
|
||||
@ -770,7 +778,7 @@
|
||||
this._loadPhotos(cursor.taken.toString().replace(/T.*/, "") + "_" + cursor.id, true, this.limit * 2);
|
||||
}
|
||||
|
||||
}.bind(this));
|
||||
}.bind(this, path));
|
||||
},
|
||||
|
||||
_loadAlbums: function() {
|
||||
@ -779,8 +787,15 @@
|
||||
}
|
||||
this.loadingAlbums = true;
|
||||
|
||||
window.fetch("api/v1/albums" + (this.path || ""), function(error, xhr) {
|
||||
var path = this.path || "";
|
||||
window.fetch("api/v1/albums" + path, function(path, error, xhr) {
|
||||
this.loadingAlbums = false;
|
||||
if (path != (this.path || "")) {
|
||||
console.log("Skipping results for old query. Triggering re-fetch of albums for new path.");
|
||||
this._loadAlbums();
|
||||
return;
|
||||
}
|
||||
|
||||
if (error) {
|
||||
console.log("Error loading album: " + (this.path || ""));
|
||||
console.error(JSON.stringify(error, null, 2));
|
||||
@ -800,7 +815,7 @@
|
||||
}
|
||||
|
||||
this.albums = results;
|
||||
}.bind(this));
|
||||
}.bind(this, path));
|
||||
},
|
||||
|
||||
onResize: function(event) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user