@rebasepro/client 0.13.0 → 0.13.1-canary.g3660bd5
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/dist/index.es.js +93 -58
- package/dist/index.es.js.map +1 -1
- package/dist/offline-query.d.ts +18 -3
- package/package.json +4 -4
- package/src/auth-listener-errors.test.ts +57 -0
- package/src/auth.ts +10 -1
- package/src/collection-listen-meta.test.ts +105 -0
- package/src/collection-observe.test.ts +138 -0
- package/src/collection.ts +88 -46
- package/src/index.ts +48 -15
- package/src/offline-query.test.ts +28 -2
- package/src/offline-query.ts +20 -7
- package/src/offline.ts +6 -4
- package/src/realtime-optout.test.ts +15 -15
- package/src/realtime-subscription-key.test.ts +92 -0
- package/src/transport-baseurl.test.ts +49 -1
- package/src/transport.ts +22 -0
- package/src/websocket-url.test.ts +97 -0
- package/src/websocket.ts +18 -9
package/src/websocket.ts
CHANGED
|
@@ -1288,6 +1288,9 @@ options }
|
|
|
1288
1288
|
|
|
1289
1289
|
const obj = val as Record<string, unknown>;
|
|
1290
1290
|
if (obj.__type === "relation") {
|
|
1291
|
+
// `data` is dropped on purpose: a relation compares by the
|
|
1292
|
+
// reference it holds, not by the row it happens to have loaded.
|
|
1293
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
1291
1294
|
const { data, ...rest } = obj;
|
|
1292
1295
|
return rest;
|
|
1293
1296
|
}
|
|
@@ -1803,16 +1806,22 @@ onError });
|
|
|
1803
1806
|
}
|
|
1804
1807
|
|
|
1805
1808
|
private createCollectionSubscriptionKey(props: FetchCollectionProps): string {
|
|
1806
|
-
//
|
|
1809
|
+
// Derived from the props, not a hand-listed subset of them.
|
|
1810
|
+
//
|
|
1811
|
+
// Two subscriptions share one server subscription when their keys
|
|
1812
|
+
// match, so a field left off the key makes two different queries
|
|
1813
|
+
// collide and hands the second listener the first one's rows. `offset`
|
|
1814
|
+
// and `logical` were both missing: page two of a live list showed page
|
|
1815
|
+
// one, and two views filtered by different `or(...)` groups saw the
|
|
1816
|
+
// same rows. Listing fields by hand is what let that happen, so the key
|
|
1817
|
+
// now covers whatever `FetchCollectionProps` carries.
|
|
1818
|
+
//
|
|
1819
|
+
// `collection` is the exception: it is the whole collection config,
|
|
1820
|
+
// property thunks and all, so it contributes its name as before.
|
|
1821
|
+
const { collection, ...query } = props as FetchCollectionProps & Record<string, unknown>;
|
|
1807
1822
|
const key = {
|
|
1808
|
-
|
|
1809
|
-
|
|
1810
|
-
limit: props.limit,
|
|
1811
|
-
startAfter: props.startAfter,
|
|
1812
|
-
orderBy: props.orderBy,
|
|
1813
|
-
order: props.order,
|
|
1814
|
-
searchString: props.searchString,
|
|
1815
|
-
collection: props.collection?.name
|
|
1823
|
+
...query,
|
|
1824
|
+
collection: collection?.name
|
|
1816
1825
|
};
|
|
1817
1826
|
// Use replacer function (not array) to sort keys at all levels for deterministic output
|
|
1818
1827
|
return JSON.stringify(key, (_, value) => {
|