mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-01-01 13:20:41 +01:00
fix: bug where page wouldn't complete loading if data.scripts was emptied
This commit is contained in:
@@ -344,7 +344,7 @@ ajaxify = window.ajaxify || {};
|
||||
// Require and parse modules
|
||||
let outstanding = data.scripts.length;
|
||||
|
||||
data.scripts.map(function (script) {
|
||||
const scripts = data.scripts.map(function (script) {
|
||||
if (typeof script === 'function') {
|
||||
return function (next) {
|
||||
script();
|
||||
@@ -369,14 +369,20 @@ ajaxify = window.ajaxify || {};
|
||||
};
|
||||
}
|
||||
return null;
|
||||
}).filter(Boolean).forEach(function (fn) {
|
||||
fn(function () {
|
||||
outstanding -= 1;
|
||||
if (outstanding === 0) {
|
||||
callback();
|
||||
}
|
||||
}).filter(Boolean);
|
||||
|
||||
if (scripts.length) {
|
||||
scripts.forEach(function (fn) {
|
||||
fn(function () {
|
||||
outstanding -= 1;
|
||||
if (outstanding === 0) {
|
||||
callback();
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
} else {
|
||||
callback();
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user