hgweb: fix unstoppable loading of graph when no more results
authorAlexander Plavin <alexander@plav.in>
Sat, 12 Oct 2013 11:29:28 +0400
changeset 19907 aebfbb68fe92
parent 19906 1dba26575dba
child 19908 07ee5c8867ca
hgweb: fix unstoppable loading of graph when no more results When a user reaches the end of repo history with graph view, it (unsuccessfully) tried to load more entries. This patch disables further loading attempts.
mercurial/templates/static/mercurial.js
--- a/mercurial/templates/static/mercurial.js	Wed Jul 24 03:20:26 2013 +0400
+++ b/mercurial/templates/static/mercurial.js	Sat Oct 12 11:29:28 2013 +0400
@@ -393,8 +393,6 @@
                     appendFormatHTML(container, messageFormat, message);
                 },
                 function onsuccess(htmlText) {
-                    nextPageVar = nextPageVarGet(htmlText, nextPageVar);
-
                     if (mode == 'graph') {
                         var addHeight = htmlText.match(/^<canvas id="graph".*height="(\d+)"><\/canvas>$/m)[1];
                         addHeight = parseInt(addHeight);
@@ -402,6 +400,9 @@
 
                         var dataStr = htmlText.match(/^\s*var data = (.*);$/m)[1];
                         var data = JSON.parse(dataStr)
+                        if (data.length < nextPageVar) {
+                            nextPageVar = undefined;
+                        }
                         graph.reset();
                         graph.render(data);
                     } else {
@@ -416,6 +417,8 @@
                         }
                         process_dates('.' + curClass);
                     }
+
+                    nextPageVar = nextPageVarGet(htmlText, nextPageVar);
                 },
                 function onerror(errorText) {
                     var message = {