Make sure successive clicks to open a folder get cancelled if the previous click hasn't finished rendering

This commit is contained in:
Junior 2026-11-08 15:44:22 -05:00
parent 863a3d4af4
commit 0988f1df2a

View File

@ -1,4 +1,6 @@
const NOREFRESH = false; const NOREFRESH = false;
var folderRequest = false;
toastr.options.escapeHtml = true;
// This function is executed after the page load completes on the client // This function is executed after the page load completes on the client
$(document).ready(function() { $(document).ready(function() {
@ -92,6 +94,8 @@ function cycleSortOrder() {
* @returns {void} * @returns {void}
*/ */
function getFolderContents() { function getFolderContents() {
if ( folderRequest ) return;
folderRequest = true;
$("#list").html(""); $("#list").html("");
toastr.info("Loading folder contents. Comics containing a large number of issues, or issues with a large number of pages, that have not been opened recently may take some time to load. Thank you for your patience!", "Loading Contents...", {timeOut: 15000}); toastr.info("Loading folder contents. Comics containing a large number of issues, or issues with a large number of pages, that have not been opened recently may take some time to load. Thank you for your patience!", "Loading Contents...", {timeOut: 15000});
$.ajax({ $.ajax({
@ -111,6 +115,9 @@ function getFolderContents() {
toastr.error("There was an error retrieving the current folder contents.", "API Error...", {timeOut: 15000}); toastr.error("There was an error retrieving the current folder contents.", "API Error...", {timeOut: 15000});
console.log(xhr.status); console.log(xhr.status);
console.log(err); console.log(err);
},
complete : function(xhr, stat) {
folderRequest = false;
} }
}); });
} }