From 00861bb7c740517d9aeec32541ffeb38646178fa Mon Sep 17 00:00:00 2001 From: nmihajlovski Date: Sun, 11 Dec 2016 12:23:42 +0100 Subject: [PATCH] Stopping the infinite stream when no data is available anymore. --- assets/angular/stream.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/assets/angular/stream.js b/assets/angular/stream.js index 74bba957cc..f3e644c4c0 100644 --- a/assets/angular/stream.js +++ b/assets/angular/stream.js @@ -9,10 +9,11 @@ Rapidoid.plugin(function(app) { this.lastId = ''; this.dataUrl = dataUrl; this.cols = 1; + this.reachedEnd = false; }; StreamData.prototype.nextPage = function() { - if (this.busy) + if (this.busy || this.reachedEnd) return; this.busy = true; @@ -26,6 +27,7 @@ Rapidoid.plugin(function(app) { } this.page++; this.busy = false; + this.reachedEnd = items.length == 0; }.bind(this)); };