# HG changeset patch # User Alexander Plavin # Date 2013-10-12 07:29:28 # Node ID aebfbb68fe9277803d9f68943bf2e63391bd08c5 # Parent 1dba26575dba49be8d7d2e6589c227419cfd1895 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. diff --git a/mercurial/templates/static/mercurial.js b/mercurial/templates/static/mercurial.js --- a/mercurial/templates/static/mercurial.js +++ b/mercurial/templates/static/mercurial.js @@ -393,8 +393,6 @@ function ajaxScrollInit(urlFormat, appendFormatHTML(container, messageFormat, message); }, function onsuccess(htmlText) { - nextPageVar = nextPageVarGet(htmlText, nextPageVar); - if (mode == 'graph') { var addHeight = htmlText.match(/^<\/canvas>$/m)[1]; addHeight = parseInt(addHeight); @@ -402,6 +400,9 @@ function ajaxScrollInit(urlFormat, 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 @@ function ajaxScrollInit(urlFormat, } process_dates('.' + curClass); } + + nextPageVar = nextPageVarGet(htmlText, nextPageVar); }, function onerror(errorText) { var message = {