@rebasepro/firebase 0.14.0 → 0.14.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.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@rebasepro/firebase",
3
3
  "type": "module",
4
- "version": "0.14.0",
4
+ "version": "0.14.1",
5
5
  "license": "MIT",
6
6
  "publishConfig": {
7
7
  "access": "public"
@@ -14,13 +14,13 @@
14
14
  "fast-equals": "6.0.2",
15
15
  "fuse.js": "^7.5.0",
16
16
  "react-router": "^8.3.0",
17
- "@rebasepro/admin-types": "0.14.0",
18
- "@rebasepro/admin": "0.14.0",
19
- "@rebasepro/types": "0.14.0",
20
- "@rebasepro/common": "0.14.0",
21
- "@rebasepro/app": "0.14.0",
22
- "@rebasepro/ui": "0.14.0",
23
- "@rebasepro/utils": "0.14.0"
17
+ "@rebasepro/admin": "0.14.1",
18
+ "@rebasepro/app": "0.14.1",
19
+ "@rebasepro/admin-types": "0.14.1",
20
+ "@rebasepro/types": "0.14.1",
21
+ "@rebasepro/ui": "0.14.1",
22
+ "@rebasepro/utils": "0.14.1",
23
+ "@rebasepro/common": "0.14.1"
24
24
  },
25
25
  "peerDependencies": {
26
26
  "firebase": "^10.12.2 || ^11.0.0 || ^12.0.0",
@@ -1,4 +1,5 @@
1
- import { DataDriver, DeleteProps, CollectionConfig, EntityReference, FetchCollectionProps, FetchOneProps, FilterValues, GeoPoint, ListenCollectionProps, ListenOneProps, SaveProps, WhereFilterOp } from "@rebasepro/types";
1
+ import { DataDriver, DeleteProps, CollectionConfig, EntityReference, FetchCollectionProps, FetchOneProps, FilterValues, GeoPoint, ListenCollectionProps, ListenOneProps, OrderByTuple, SaveProps, WhereFilterOp } from "@rebasepro/types";
2
+ import { normalizeDriverOrderBy } from "@rebasepro/common";
2
3
  import { FilterCombination } from "@rebasepro/admin-types";
3
4
  import { User } from "firebase/auth";
4
5
  import {
@@ -133,7 +134,7 @@ export function useFirestoreDriver({
133
134
 
134
135
  const buildQuery = useCallback(<M>(path: string,
135
136
  filter: FilterValues<Extract<keyof M, string>> | undefined,
136
- orderBy: string | undefined,
137
+ orderBy: string | OrderByTuple[] | undefined,
137
138
  order: "desc" | "asc" | undefined,
138
139
  startAfter: unknown[] | undefined,
139
140
  limit: number | undefined,
@@ -174,8 +175,12 @@ export function useFirestoreDriver({
174
175
  });
175
176
  }
176
177
 
177
- if (orderBy && order) {
178
- queryParams.push(orderByClause(orderBy, order));
178
+ // Firestore composes several `orderBy` constraints into a compound sort,
179
+ // applied in the order they are added — the same meaning the tuple list
180
+ // carries. It needs a matching composite index; without one Firestore
181
+ // refuses the query outright rather than answering it half-sorted.
182
+ for (const [field, direction] of normalizeDriverOrderBy(orderBy, order) ?? []) {
183
+ queryParams.push(orderByClause(field, direction));
179
184
  }
180
185
 
181
186
  if (startAfter) {