@ai-matrx/records 0.87.17 → 0.87.19

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.
@@ -3436,7 +3436,12 @@ function createRecordsClient(given) {
3436
3436
  );
3437
3437
  let total = Number(answer?.total ?? 0);
3438
3438
  let locked = 0;
3439
- const plainPage = (!filter || Object.keys(filter).length === 0) && (!search || search.trim() === "") && (!sort || sort.length === 0) && view_id == null;
3439
+ const unfiltered = (!filter || Object.keys(filter).length === 0) && (!search || search.trim() === "") && view_id == null;
3440
+ const plainPage = unfiltered && (!sort || sort.length === 0);
3441
+ const lockedOffPage = Number(answer?.locked ?? 0);
3442
+ if (!plainPage && unfiltered && Number.isFinite(lockedOffPage) && lockedOffPage > 0) {
3443
+ locked = Math.max(lockedOnPage, lockedOffPage);
3444
+ }
3440
3445
  if (plainPage) {
3441
3446
  const counted = await client.recordAggregate({ table_id, measures: [{ op: "count" }] });
3442
3447
  if (!counted.ok) return err(counted.error);
@@ -3446,7 +3451,7 @@ function createRecordsClient(given) {
3446
3451
  }
3447
3452
  locked = openable <= total ? Math.max(lockedOnPage, total - openable) : lockedOnPage;
3448
3453
  total = openable;
3449
- } else if (lockedOnPage > 0) {
3454
+ } else if (lockedOnPage > 0 && locked === 0) {
3450
3455
  locked = lockedOnPage;
3451
3456
  total = Math.max(rows.length, total - lockedOnPage);
3452
3457
  }