abmp-npm 10.3.21 → 10.3.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -244,9 +244,15 @@ async function fetchAllItemsInParallel(query) {
|
|
|
244
244
|
const batchSize = WIX_QUERY_MAX_LIMIT;
|
|
245
245
|
const allItems = [];
|
|
246
246
|
|
|
247
|
-
|
|
247
|
+
// @wix/data leaves totalPages undefined unless the count is requested explicitly, so reading it
|
|
248
|
+
// off the first page silently stopped this at 1,000 rows. Count first; count() is already what
|
|
249
|
+
// the typed search relies on.
|
|
250
|
+
const [totalCount, firstResult] = await Promise.all([
|
|
251
|
+
query.count(),
|
|
252
|
+
query.skip(0).limit(batchSize).find(),
|
|
253
|
+
]);
|
|
248
254
|
|
|
249
|
-
const totalBatches =
|
|
255
|
+
const totalBatches = Math.ceil(totalCount / batchSize);
|
|
250
256
|
allItems.push(...firstResult.items);
|
|
251
257
|
|
|
252
258
|
if (totalBatches > 1) {
|