changeset 19907:aebfbb68fe92

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.
author Alexander Plavin <alexander@plav.in>
date Sat, 12 Oct 2013 11:29:28 +0400
parents 1dba26575dba
children 07ee5c8867ca
files mercurial/templates/static/mercurial.js
diffstat 1 files changed, 5 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- 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 = {