Fix limit>100 bug

This commit is contained in:
Ryan Pandya 2023-07-27 13:21:05 -07:00
parent 9567851e3f
commit ae4bdb74a2

View File

@ -84,7 +84,8 @@ class AppwriteService {
var documents = []; // Start with nothing loaded
var limit = 100;
while(limit > 0){ // Make repeated requests until we hit the numEntries
while(limit > 0){
// Make repeated requests until we hit the numEntries
let newEntries = (await this.database.listDocuments(
this.databaseId, this.collectionId, [
Query.orderAsc("date"),
@ -96,7 +97,8 @@ class AppwriteService {
documents = documents.flat();
offset += limit; // Increment offset by the amount we just loaded
limit = numEntries - offset; // This might not work
limit = numEntries - offset;
if(limit > 100){ limit = 100} // This might not work
// console.log(numEntries + " entries; offset " + offset + "; limit " + limit);
};