fix: make getSummary response call synchronous to avoid db issues (#4564)

This commit is contained in:
Matti Nannt
2025-01-07 17:43:29 +01:00
committed by GitHub
parent 71c92766d3
commit aebe36b9e8

View File

@@ -907,12 +907,11 @@ export const getSurveySummary = reactCache(
const pages = Math.ceil(filteredResponseCount / batchSize);
const responsesArray = await Promise.all(
Array.from({ length: pages }, (_, i) => {
return getResponses(surveyId, batchSize, i * batchSize, filterCriteria);
})
);
const responses = responsesArray.flat();
let responses: TResponse[] = [];
for (let i = 0; i < pages; i++) {
const batchResponses = await getResponses(surveyId, batchSize, i * batchSize, filterCriteria);
responses = responses.concat(batchResponses);
}
const responseIds = hasFilter ? responses.map((response) => response.id) : [];