mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2025-03-12 15:08:45 +08:00
stopping the leaderboards from requesting same data multiple times
This commit is contained in:
parent
91fb312f57
commit
6e204e8ef5
1 changed files with 8 additions and 0 deletions
|
@ -17,6 +17,11 @@ let currentRank = {
|
|||
60: {},
|
||||
};
|
||||
|
||||
let requesting = {
|
||||
15: false,
|
||||
60: false,
|
||||
};
|
||||
|
||||
let leaderboardSingleLimit = 50;
|
||||
|
||||
let updateTimer;
|
||||
|
@ -326,6 +331,8 @@ function update() {
|
|||
|
||||
async function requestMore(lb, prepend = false) {
|
||||
if (prepend && currentData[lb][0].rank === 1) return;
|
||||
if (requesting[lb]) return;
|
||||
requesting[lb] = true;
|
||||
showLoader(lb);
|
||||
let skipVal = currentData[lb][currentData[lb].length - 1].rank;
|
||||
if (prepend) {
|
||||
|
@ -360,6 +367,7 @@ async function requestMore(lb, prepend = false) {
|
|||
}
|
||||
fillTable(lb, limitVal);
|
||||
hideLoader(lb);
|
||||
requesting[lb] = false;
|
||||
}
|
||||
|
||||
async function requestNew(lb, skip) {
|
||||
|
|
Loading…
Reference in a new issue