Group calendar cringe toggle

This commit is contained in:
Natsumi
2025-11-25 01:11:13 +11:00
parent 7b4ebc0ccd
commit 4cb2946ea9
6 changed files with 175 additions and 49 deletions

View File

@@ -371,7 +371,16 @@ export async function processBulk(options) {
try {
while (true) {
const result = await fn(params);
const batchSize = result.json.length;
let batchSize = 0;
if (Array.isArray(result.json)) {
batchSize = result.json.length;
} else if (Array.isArray(result.results)) {
batchSize = result.results.length;
} else {
throw new Error(
'Invalid result format: expected an array in result.json or result.results'
);
}
if (typeof handle === 'function') {
handle(result);
@@ -379,6 +388,9 @@ export async function processBulk(options) {
if (batchSize === 0) {
break;
}
if (typeof result.hasNext === 'boolean' && !result.hasNext) {
break;
}
if (N > 0) {
totalFetched += batchSize;