Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions apps/frontend/src/pages/moderation/reports/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -103,12 +103,16 @@ const { data: allReports } = await useLazyAsyncData('new-moderation-reports', as
const enrichmentPromises: Promise<ExtendedReport[]>[] = []

let reports: Report[]
do {
let hasMoreReports = true
while (hasMoreReports) {
reports = (await useBaseFetch(`report?count=${REPORT_ENDPOINT_COUNT}&offset=${currentOffset}`, {
apiVersion: 3,
})) as Report[]

if (reports.length === 0) break
hasMoreReports = reports.length > 0
if (!hasMoreReports) {
break
}

const enrichmentPromise = enrichReportBatch(reports)
enrichmentPromises.push(enrichmentPromise)
Expand All @@ -119,7 +123,7 @@ const { data: allReports } = await useLazyAsyncData('new-moderation-reports', as
const completed = await Promise.all(enrichmentPromises.splice(0, 2))
allReports.push(...completed.flat())
}
} while (reports.length === REPORT_ENDPOINT_COUNT)
}

const remainingBatches = await Promise.all(enrichmentPromises)
allReports.push(...remainingBatches.flat())
Expand Down
Loading