@naturalcycles/firestore-lib 2.16.0 → 2.16.1

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.
@@ -27,7 +27,11 @@ export function dbQueryToFirestoreQuery(dbQuery, emptyQuery) {
27
27
  q = q.orderBy(mapName(ord.name), ord.descending ? 'desc' : 'asc');
28
28
  }
29
29
  // limit
30
- q = q.limit(dbQuery._limitValue);
30
+ // Careful here, Firestore just changed the behavior of limit(0) recently!
31
+ // Therefor we're guarding the limit(0) case and not sending the limit if it's zero.
32
+ if (dbQuery._limitValue) {
33
+ q = q.limit(dbQuery._limitValue);
34
+ }
31
35
  // selectedFields
32
36
  if (dbQuery._selectedFieldNames) {
33
37
  // id is filtered out, because in Firestore it's not a "property",
package/package.json CHANGED
@@ -38,7 +38,7 @@
38
38
  "engines": {
39
39
  "node": ">=24.10.0"
40
40
  },
41
- "version": "2.16.0",
41
+ "version": "2.16.1",
42
42
  "description": "Firestore implementation of CommonDB interface",
43
43
  "author": "Natural Cycles Team",
44
44
  "license": "MIT",
package/src/query.util.ts CHANGED
@@ -40,7 +40,11 @@ export function dbQueryToFirestoreQuery<ROW extends ObjectWithId>(
40
40
  }
41
41
 
42
42
  // limit
43
- q = q.limit(dbQuery._limitValue)
43
+ // Careful here, Firestore just changed the behavior of limit(0) recently!
44
+ // Therefor we're guarding the limit(0) case and not sending the limit if it's zero.
45
+ if (dbQuery._limitValue) {
46
+ q = q.limit(dbQuery._limitValue)
47
+ }
44
48
 
45
49
  // selectedFields
46
50
  if (dbQuery._selectedFieldNames) {