@rpcbase/client 0.416.0 → 0.418.0

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.
@@ -1,4 +1,4 @@
1
- import { createContext, useContext, useId, useMemo, useState, useRef, useEffect } from "react";
1
+ import { createContext, useContext, useMemo, useState, useRef, useEffect } from "react";
2
2
  import { jsx } from "react/jsx-runtime";
3
3
  import { c } from "react/compiler-runtime";
4
4
  const STATIC_RPCBASE_RTS_HYDRATION_DATA_KEY = "__staticRpcbaseRtsHydrationData";
@@ -1178,14 +1178,31 @@ const preparePopulateCacheOptions = (options, source) => {
1178
1178
  populate
1179
1179
  };
1180
1180
  };
1181
+ const isPlainObject = (value) => {
1182
+ if (!value || typeof value !== "object" || Array.isArray(value)) return false;
1183
+ const prototype = Object.getPrototypeOf(value);
1184
+ return prototype === Object.prototype || prototype === null;
1185
+ };
1186
+ const serializeRtsQueryValue = (value) => {
1187
+ return JSON.stringify(value, (_key, currentValue) => {
1188
+ if (!isPlainObject(currentValue)) return currentValue;
1189
+ return Object.keys(currentValue).sort().reduce((acc, key) => {
1190
+ acc[key] = currentValue[key];
1191
+ return acc;
1192
+ }, {});
1193
+ }) ?? "";
1194
+ };
1181
1195
  const computeRtsQueryKey = (query, options) => {
1182
1196
  const key = options.key ?? "";
1183
- const projection = options.projection ? JSON.stringify(options.projection) : "";
1184
- const sort = options.sort ? JSON.stringify(options.sort) : "";
1197
+ const projection = options.projection ? serializeRtsQueryValue(options.projection) : "";
1198
+ const sort = options.sort ? serializeRtsQueryValue(options.sort) : "";
1185
1199
  const limit = typeof options.limit === "number" ? String(options.limit) : "";
1186
- const populate = options.populate ? JSON.stringify(options.populate) : "";
1187
- const pagination = options.pagination ? JSON.stringify(options.pagination) : "";
1188
- return `${key}${JSON.stringify(query)}${projection}${sort}${limit}${populate}${pagination}`;
1200
+ const populate = options.populate ? serializeRtsQueryValue(options.populate) : "";
1201
+ const pagination = options.pagination ? serializeRtsQueryValue(options.pagination) : "";
1202
+ return `${key}${serializeRtsQueryValue(query)}${projection}${sort}${limit}${populate}${pagination}`;
1203
+ };
1204
+ const hasSnapshotError = (snapshot) => {
1205
+ return snapshot?.error !== null && snapshot?.error !== void 0;
1189
1206
  };
1190
1207
  const TENANT_ID_QUERY_PARAM = "rb-tenant-id";
1191
1208
  const RTS_CHANGES_PATH = "/api/rb/rts/changes";
@@ -1400,6 +1417,121 @@ const normalizeTotalCount$1 = (value) => {
1400
1417
  if (!Number.isFinite(value) || value < 0) return void 0;
1401
1418
  return Math.floor(value);
1402
1419
  };
1420
+ const updateQuerySubscriptionSnapshot = (subscription, snapshot) => {
1421
+ if (snapshot.context.source === "cache" && subscription.lastSnapshot?.context.source === "network") {
1422
+ return false;
1423
+ }
1424
+ subscription.lastSnapshot = snapshot;
1425
+ return true;
1426
+ };
1427
+ const updateCountSubscriptionSnapshot = (subscription, snapshot) => {
1428
+ if (snapshot.context.source === "cache" && subscription.lastSnapshot?.context.source === "network") {
1429
+ return false;
1430
+ }
1431
+ subscription.lastSnapshot = snapshot;
1432
+ return true;
1433
+ };
1434
+ const dispatchQuerySnapshotToSubscription = (subscription, snapshot) => {
1435
+ for (const callback of subscription.callbacks) {
1436
+ callback(snapshot.error, snapshot.data, snapshot.context);
1437
+ }
1438
+ };
1439
+ const dispatchQuerySnapshotToOneshotCallbacks = (cbKey, snapshot) => {
1440
+ const callbacks = queryCallbacks.get(cbKey);
1441
+ if (!callbacks || !callbacks.size) return;
1442
+ for (const callback of callbacks) {
1443
+ callback(snapshot.error, snapshot.data, snapshot.context);
1444
+ }
1445
+ };
1446
+ const dispatchCountSnapshotToSubscription = (subscription, snapshot) => {
1447
+ for (const callback of subscription.callbacks) {
1448
+ callback(snapshot.error, snapshot.count, snapshot.context);
1449
+ }
1450
+ };
1451
+ const dispatchCountSnapshotToOneshotCallbacks = (cbKey, snapshot) => {
1452
+ const callbacks = countCallbacks.get(cbKey);
1453
+ if (!callbacks || !callbacks.size) return;
1454
+ for (const callback of callbacks) {
1455
+ callback(snapshot.error, snapshot.count, snapshot.context);
1456
+ }
1457
+ };
1458
+ const requestRegisteredQueryRefresh = (subscription) => {
1459
+ sendToServer({
1460
+ type: "run-query",
1461
+ modelName: subscription.modelName,
1462
+ queryKey: subscription.queryKey,
1463
+ query: subscription.query,
1464
+ options: subscription.options
1465
+ });
1466
+ };
1467
+ const requestRegisteredCountRefresh = (subscription) => {
1468
+ sendToServer({
1469
+ type: "run-count",
1470
+ modelName: subscription.modelName,
1471
+ queryKey: subscription.queryKey,
1472
+ query: subscription.query,
1473
+ options: subscription.options
1474
+ });
1475
+ };
1476
+ const requestSubscriptionLocalQuery = (cbKey, subscription) => {
1477
+ if (!currentUid || subscription.options.pagination) return;
1478
+ const populateCache = subscription.populateCache;
1479
+ const hasPopulate = Boolean(populateCache);
1480
+ if (hasPopulate && populateCache) {
1481
+ void runPopulatedQuery({
1482
+ modelName: subscription.modelName,
1483
+ query: subscription.query,
1484
+ options: {
1485
+ uid: currentUid,
1486
+ projection: populateCache.rootProjection,
1487
+ sort: subscription.options.sort,
1488
+ limit: subscription.options.limit,
1489
+ populate: populateCache.populate
1490
+ }
1491
+ }).then(({
1492
+ hit,
1493
+ data,
1494
+ context
1495
+ }) => {
1496
+ if (!hit) return;
1497
+ const currentSubscription = subscriptions.get(cbKey);
1498
+ if (!currentSubscription) return;
1499
+ const snapshot = {
1500
+ error: null,
1501
+ data,
1502
+ context
1503
+ };
1504
+ if (!updateQuerySubscriptionSnapshot(currentSubscription, snapshot)) return;
1505
+ dispatchQuerySnapshotToSubscription(currentSubscription, snapshot);
1506
+ }).catch(() => {
1507
+ });
1508
+ return;
1509
+ }
1510
+ void runQuery({
1511
+ modelName: subscription.modelName,
1512
+ query: subscription.query,
1513
+ options: {
1514
+ uid: currentUid,
1515
+ projection: subscription.options.projection,
1516
+ sort: subscription.options.sort,
1517
+ limit: subscription.options.limit
1518
+ }
1519
+ }).then(({
1520
+ data,
1521
+ context
1522
+ }) => {
1523
+ const currentSubscription = subscriptions.get(cbKey);
1524
+ if (!currentSubscription) return;
1525
+ const snapshot = {
1526
+ error: null,
1527
+ data,
1528
+ context
1529
+ };
1530
+ if (!updateQuerySubscriptionSnapshot(currentSubscription, snapshot)) return;
1531
+ dispatchQuerySnapshotToSubscription(currentSubscription, snapshot);
1532
+ }).catch(() => {
1533
+ });
1534
+ };
1403
1535
  const handleQueryPayload = (payload) => {
1404
1536
  const {
1405
1537
  modelName,
@@ -1409,9 +1541,10 @@ const handleQueryPayload = (payload) => {
1409
1541
  txnId
1410
1542
  } = payload;
1411
1543
  const cbKey = `${modelName}.${queryKey}`;
1412
- const callbacks = queryCallbacks.get(cbKey);
1413
- if (!callbacks || !callbacks.size) return;
1414
1544
  const subscription = subscriptions.get(cbKey);
1545
+ const hasSubscriptionCallbacks = Boolean(subscription?.callbacks.size);
1546
+ const hasOneshotCallbacks = Boolean(queryCallbacks.get(cbKey)?.size);
1547
+ if (!hasSubscriptionCallbacks && !hasOneshotCallbacks) return;
1415
1548
  const pageInfo = normalizePageInfo$1(payload.pageInfo);
1416
1549
  const totalCount = normalizeTotalCount$1(payload.totalCount);
1417
1550
  const populateCache = subscription?.populateCache;
@@ -1429,11 +1562,22 @@ const handleQueryPayload = (payload) => {
1429
1562
  totalCount
1430
1563
  } : {}
1431
1564
  };
1565
+ const snapshot = {
1566
+ error: error ?? null,
1567
+ data,
1568
+ context
1569
+ };
1432
1570
  if (error) {
1433
- for (const cb of callbacks) cb(error, void 0, context);
1571
+ if (subscription && updateQuerySubscriptionSnapshot(subscription, snapshot)) {
1572
+ dispatchQuerySnapshotToSubscription(subscription, snapshot);
1573
+ }
1574
+ dispatchQuerySnapshotToOneshotCallbacks(cbKey, snapshot);
1434
1575
  return;
1435
1576
  }
1436
- for (const cb of callbacks) cb(null, data, context);
1577
+ if (subscription && updateQuerySubscriptionSnapshot(subscription, snapshot)) {
1578
+ dispatchQuerySnapshotToSubscription(subscription, snapshot);
1579
+ }
1580
+ dispatchQuerySnapshotToOneshotCallbacks(cbKey, snapshot);
1437
1581
  if (!currentUid) return;
1438
1582
  const docs = Array.isArray(data) ? data.filter(isDocWithId) : [];
1439
1583
  if (hasPagination) return;
@@ -1460,20 +1604,33 @@ const handleCountPayload = (payload) => {
1460
1604
  txnId
1461
1605
  } = payload;
1462
1606
  const cbKey = `${modelName}.${queryKey}`;
1463
- const callbacks = countCallbacks.get(cbKey);
1464
- if (!callbacks || !callbacks.size) return;
1607
+ const subscription = countSubscriptions.get(cbKey);
1608
+ const hasSubscriptionCallbacks = Boolean(subscription?.callbacks.size);
1609
+ const hasOneshotCallbacks = Boolean(countCallbacks.get(cbKey)?.size);
1610
+ if (!hasSubscriptionCallbacks && !hasOneshotCallbacks) return;
1465
1611
  const isLocal = !!(txnId && localTxnBuf.includes(txnId));
1466
1612
  const context = {
1467
1613
  source: "network",
1468
1614
  isLocal,
1469
1615
  txnId
1470
1616
  };
1617
+ const normalizedCount = normalizeTotalCount$1(count);
1618
+ const snapshot = {
1619
+ error: error ?? null,
1620
+ count: normalizedCount,
1621
+ context
1622
+ };
1471
1623
  if (error) {
1472
- for (const cb of callbacks) cb(error, void 0, context);
1624
+ if (subscription && updateCountSubscriptionSnapshot(subscription, snapshot)) {
1625
+ dispatchCountSnapshotToSubscription(subscription, snapshot);
1626
+ }
1627
+ dispatchCountSnapshotToOneshotCallbacks(cbKey, snapshot);
1473
1628
  return;
1474
1629
  }
1475
- const normalizedCount = normalizeTotalCount$1(count);
1476
- for (const cb of callbacks) cb(null, normalizedCount, context);
1630
+ if (subscription && updateCountSubscriptionSnapshot(subscription, snapshot)) {
1631
+ dispatchCountSnapshotToSubscription(subscription, snapshot);
1632
+ }
1633
+ dispatchCountSnapshotToOneshotCallbacks(cbKey, snapshot);
1477
1634
  };
1478
1635
  const handleEvent = (payload) => {
1479
1636
  const callbacks = messageCallbacks.get(payload.event);
@@ -1778,84 +1935,72 @@ const registerQuery = (modelName, query, optionsOrCallback, callbackMaybe, behav
1778
1935
  const cbKey = `${modelName}.${queryKey}`;
1779
1936
  const runInitialNetworkQuery = behavior?.runInitialNetworkQuery !== false;
1780
1937
  const runInitialLocalQuery = behavior?.runInitialLocalQuery !== false;
1938
+ const forceRefreshOnMount = behavior?.forceRefreshOnMount === true;
1781
1939
  const populateCache = preparePopulateCacheOptions({
1782
1940
  projection: options.projection,
1783
1941
  populate: options.populate
1784
1942
  }, "registerQuery");
1785
- const hasPopulate = Boolean(populateCache);
1786
1943
  const hasPagination = Boolean(options.pagination);
1787
- const set = queryCallbacks.get(cbKey) ?? /* @__PURE__ */ new Set();
1788
- set.add(callback);
1789
- queryCallbacks.set(cbKey, set);
1790
- subscriptions.set(cbKey, {
1944
+ const existingSubscription = subscriptions.get(cbKey);
1945
+ const subscription = existingSubscription ?? {
1791
1946
  modelName,
1792
1947
  query,
1793
1948
  options,
1794
1949
  queryKey,
1950
+ callbacks: /* @__PURE__ */ new Set(),
1795
1951
  runInitialNetworkQuery,
1952
+ hasRequestedInitialLocalQuery: false,
1796
1953
  ...populateCache ? {
1797
1954
  populateCache
1798
1955
  } : {}
1799
- });
1800
- if (currentUid && runInitialLocalQuery && !hasPagination) {
1801
- if (hasPopulate && populateCache) {
1802
- void runPopulatedQuery({
1803
- modelName,
1804
- query,
1805
- options: {
1806
- uid: currentUid,
1807
- projection: populateCache.rootProjection,
1808
- sort: options.sort,
1809
- limit: options.limit,
1810
- populate: populateCache.populate
1811
- }
1812
- }).then(({
1813
- hit,
1814
- data,
1815
- context
1816
- }) => {
1817
- if (!hit) return;
1818
- callback?.(null, data, context);
1819
- }).catch(() => {
1820
- });
1821
- } else {
1822
- void runQuery({
1823
- modelName,
1824
- query,
1825
- options: {
1826
- uid: currentUid,
1827
- projection: options.projection,
1828
- sort: options.sort,
1829
- limit: options.limit
1830
- }
1831
- }).then(({
1832
- data,
1833
- context
1834
- }) => {
1835
- callback?.(null, data, context);
1836
- }).catch(() => {
1837
- });
1956
+ };
1957
+ const hadCallbacks = subscription.callbacks.size > 0;
1958
+ const hadInitialNetworkQuery = subscription.runInitialNetworkQuery;
1959
+ subscription.callbacks.add(callback);
1960
+ if (runInitialNetworkQuery) {
1961
+ subscription.runInitialNetworkQuery = true;
1962
+ }
1963
+ subscriptions.set(cbKey, subscription);
1964
+ let seeded = false;
1965
+ if (behavior?.seedSnapshot && updateQuerySubscriptionSnapshot(subscription, behavior.seedSnapshot)) {
1966
+ dispatchQuerySnapshotToSubscription(subscription, behavior.seedSnapshot);
1967
+ seeded = true;
1968
+ }
1969
+ if (!seeded && hadCallbacks && subscription.lastSnapshot && !hasSnapshotError(subscription.lastSnapshot)) {
1970
+ callback(subscription.lastSnapshot.error, subscription.lastSnapshot.data, subscription.lastSnapshot.context);
1971
+ }
1972
+ if (!hadCallbacks) {
1973
+ if (runInitialLocalQuery && !hasPagination) {
1974
+ subscription.hasRequestedInitialLocalQuery = true;
1975
+ requestSubscriptionLocalQuery(cbKey, subscription);
1838
1976
  }
1839
- }
1840
- sendToServer({
1841
- type: "register-query",
1842
- modelName,
1843
- queryKey,
1844
- query,
1845
- options,
1846
- runInitialQuery: runInitialNetworkQuery
1847
- });
1848
- return () => {
1849
1977
  sendToServer({
1850
- type: "remove-query",
1978
+ type: "register-query",
1851
1979
  modelName,
1852
- queryKey
1980
+ queryKey,
1981
+ query,
1982
+ options,
1983
+ runInitialQuery: runInitialNetworkQuery
1853
1984
  });
1854
- const callbacks = queryCallbacks.get(cbKey);
1855
- callbacks?.delete(callback);
1856
- if (callbacks && callbacks.size === 0) {
1857
- queryCallbacks.delete(cbKey);
1985
+ } else {
1986
+ if (runInitialLocalQuery && !subscription.hasRequestedInitialLocalQuery && !hasPagination) {
1987
+ subscription.hasRequestedInitialLocalQuery = true;
1988
+ requestSubscriptionLocalQuery(cbKey, subscription);
1989
+ }
1990
+ if (forceRefreshOnMount || runInitialNetworkQuery && (!hadInitialNetworkQuery || hasSnapshotError(subscription.lastSnapshot))) {
1991
+ requestRegisteredQueryRefresh(subscription);
1992
+ }
1993
+ }
1994
+ return () => {
1995
+ const currentSubscription = subscriptions.get(cbKey);
1996
+ currentSubscription?.callbacks.delete(callback);
1997
+ if (currentSubscription && currentSubscription.callbacks.size === 0) {
1858
1998
  subscriptions.delete(cbKey);
1999
+ sendToServer({
2000
+ type: "remove-query",
2001
+ modelName,
2002
+ queryKey
2003
+ });
1859
2004
  }
1860
2005
  };
1861
2006
  };
@@ -1876,29 +2021,47 @@ const registerCount = (modelName, query, optionsOrCallback, callbackMaybe, behav
1876
2021
  const queryKey = computeRtsQueryKey(query, options);
1877
2022
  const cbKey = `${modelName}.${queryKey}`;
1878
2023
  const runInitialNetworkQuery = behavior?.runInitialNetworkQuery !== false;
1879
- const set = countCallbacks.get(cbKey) ?? /* @__PURE__ */ new Set();
1880
- set.add(callback);
1881
- countCallbacks.set(cbKey, set);
1882
- countSubscriptions.set(cbKey, {
2024
+ const forceRefreshOnMount = behavior?.forceRefreshOnMount === true;
2025
+ const existingSubscription = countSubscriptions.get(cbKey);
2026
+ const subscription = existingSubscription ?? {
1883
2027
  modelName,
1884
2028
  query,
1885
2029
  options,
1886
2030
  queryKey,
2031
+ callbacks: /* @__PURE__ */ new Set(),
1887
2032
  runInitialNetworkQuery
1888
- });
1889
- sendToServer({
1890
- type: "register-count",
1891
- modelName,
1892
- queryKey,
1893
- query,
1894
- options,
1895
- runInitialQuery: runInitialNetworkQuery
1896
- });
2033
+ };
2034
+ const hadCallbacks = subscription.callbacks.size > 0;
2035
+ const hadInitialNetworkQuery = subscription.runInitialNetworkQuery;
2036
+ subscription.callbacks.add(callback);
2037
+ if (runInitialNetworkQuery) {
2038
+ subscription.runInitialNetworkQuery = true;
2039
+ }
2040
+ countSubscriptions.set(cbKey, subscription);
2041
+ let seeded = false;
2042
+ if (behavior?.seedSnapshot && updateCountSubscriptionSnapshot(subscription, behavior.seedSnapshot)) {
2043
+ dispatchCountSnapshotToSubscription(subscription, behavior.seedSnapshot);
2044
+ seeded = true;
2045
+ }
2046
+ if (!seeded && hadCallbacks && subscription.lastSnapshot && !hasSnapshotError(subscription.lastSnapshot)) {
2047
+ callback(subscription.lastSnapshot.error, subscription.lastSnapshot.count, subscription.lastSnapshot.context);
2048
+ }
2049
+ if (!hadCallbacks) {
2050
+ sendToServer({
2051
+ type: "register-count",
2052
+ modelName,
2053
+ queryKey,
2054
+ query,
2055
+ options,
2056
+ runInitialQuery: runInitialNetworkQuery
2057
+ });
2058
+ } else if (forceRefreshOnMount || runInitialNetworkQuery && (!hadInitialNetworkQuery || hasSnapshotError(subscription.lastSnapshot))) {
2059
+ requestRegisteredCountRefresh(subscription);
2060
+ }
1897
2061
  return () => {
1898
- const callbacks = countCallbacks.get(cbKey);
1899
- callbacks?.delete(callback);
1900
- if (callbacks && callbacks.size === 0) {
1901
- countCallbacks.delete(cbKey);
2062
+ const currentSubscription = countSubscriptions.get(cbKey);
2063
+ currentSubscription?.callbacks.delete(callback);
2064
+ if (currentSubscription && currentSubscription.callbacks.size === 0) {
1902
2065
  countSubscriptions.delete(cbKey);
1903
2066
  sendToServer({
1904
2067
  type: "remove-count",
@@ -2188,17 +2351,16 @@ const useQuery = (modelName, query = {}, options = {}) => {
2188
2351
  throw new Error("useQuery: modelName must be a non-empty string");
2189
2352
  }
2190
2353
  assertIncludeOnlyProjection(options.projection);
2191
- const id = useId();
2192
2354
  const enabled = options.enabled ?? true;
2193
2355
  const ssrEnabled = options.ssr !== false;
2194
2356
  const refreshOnMount = options.refreshOnMount === true;
2195
- const key = options.key ?? id;
2196
- const queryJson = JSON.stringify(query);
2197
- const projectionJson = options.projection ? JSON.stringify(options.projection) : "";
2198
- const sortJson = options.sort ? JSON.stringify(options.sort) : "";
2357
+ const key = options.key;
2358
+ const queryJson = serializeRtsQueryValue(query);
2359
+ const projectionJson = options.projection ? serializeRtsQueryValue(options.projection) : "";
2360
+ const sortJson = options.sort ? serializeRtsQueryValue(options.sort) : "";
2199
2361
  const limitStr = typeof options.limit === "number" ? String(options.limit) : "";
2200
- const populateJson = options.populate ? JSON.stringify(options.populate) : "";
2201
- const paginationJson = options.pagination ? JSON.stringify(options.pagination) : "";
2362
+ const populateJson = options.populate ? serializeRtsQueryValue(options.populate) : "";
2363
+ const paginationJson = options.pagination ? serializeRtsQueryValue(options.pagination) : "";
2202
2364
  preparePopulateCacheOptions({
2203
2365
  projection: options.projection,
2204
2366
  populate: options.populate
@@ -2354,12 +2516,12 @@ const useQuery = (modelName, query = {}, options = {}) => {
2354
2516
  return;
2355
2517
  }
2356
2518
  hasFirstReply.current = true;
2357
- const networkPageInfo = context.source === "network" ? context.pageInfo : void 0;
2358
- const networkTotalCount = context.source === "network" ? context.totalCount : void 0;
2519
+ const nextPageInfo = context.pageInfo;
2520
+ const nextTotalCount = context.totalCount;
2359
2521
  const payloadForHash = isPaginated ? {
2360
2522
  result,
2361
- pageInfo: networkPageInfo,
2362
- totalCount: networkTotalCount
2523
+ pageInfo: nextPageInfo,
2524
+ totalCount: nextTotalCount
2363
2525
  } : result;
2364
2526
  let nextJson = "";
2365
2527
  try {
@@ -2377,18 +2539,34 @@ const useQuery = (modelName, query = {}, options = {}) => {
2377
2539
  if (isPaginated) {
2378
2540
  setHeadPage({
2379
2541
  nodes: result,
2380
- ...networkPageInfo ? {
2381
- pageInfo: networkPageInfo
2542
+ ...nextPageInfo ? {
2543
+ pageInfo: nextPageInfo
2382
2544
  } : {}
2383
2545
  });
2384
- setTotalCount((current) => networkTotalCount === void 0 ? current : networkTotalCount);
2546
+ setTotalCount((current) => nextTotalCount === void 0 ? current : nextTotalCount);
2385
2547
  return;
2386
2548
  }
2387
2549
  setData(result);
2388
2550
  setTotalCount(void 0);
2389
2551
  }, {
2390
2552
  runInitialNetworkQuery,
2391
- runInitialLocalQuery
2553
+ runInitialLocalQuery,
2554
+ forceRefreshOnMount: refreshOnMount,
2555
+ ...hasSeedData ? {
2556
+ seedSnapshot: {
2557
+ error: null,
2558
+ data: seedData,
2559
+ context: {
2560
+ source: "cache",
2561
+ ...seedPageInfo ? {
2562
+ pageInfo: seedPageInfo
2563
+ } : {},
2564
+ ...seedTotalCount !== void 0 ? {
2565
+ totalCount: seedTotalCount
2566
+ } : {}
2567
+ }
2568
+ }
2569
+ } : {}
2392
2570
  });
2393
2571
  return () => {
2394
2572
  unsubscribe?.();
@@ -2535,12 +2713,13 @@ const useQuery = (modelName, query = {}, options = {}) => {
2535
2713
  }), [data, effectivePageInfo, error, fetchNext, fetchPrevious, isPaginated, loading, mergedPaginatedData, source, totalCount]);
2536
2714
  };
2537
2715
  export {
2538
- runNetworkCount as A,
2539
- runNetworkQuery as B,
2540
- runQuery as C,
2541
- sendMessage as D,
2542
- syncRtsChanges as E,
2543
- updateDocs as F,
2716
+ resetRtsPouchStore as A,
2717
+ runNetworkCount as B,
2718
+ runNetworkQuery as C,
2719
+ runQuery as D,
2720
+ sendMessage as E,
2721
+ syncRtsChanges as F,
2722
+ updateDocs as G,
2544
2723
  RtsSsrRuntimeProvider as R,
2545
2724
  STATIC_RPCBASE_RTS_HYDRATION_DATA_KEY as S,
2546
2725
  consumeHydratedRtsCount as a,
@@ -2561,13 +2740,13 @@ export {
2561
2740
  peekHydratedRtsCount as p,
2562
2741
  getCollection as q,
2563
2742
  registerCount as r,
2564
- getConnectionError as s,
2565
- getConnectionStatus as t,
2743
+ serializeRtsQueryValue as s,
2744
+ getConnectionError as t,
2566
2745
  useQuery as u,
2567
- onConnectionStatusChange as v,
2568
- onMessage as w,
2569
- reconnect as x,
2570
- registerQuery as y,
2571
- resetRtsPouchStore as z
2746
+ getConnectionStatus as v,
2747
+ onConnectionStatusChange as w,
2748
+ onMessage as x,
2749
+ reconnect as y,
2750
+ registerQuery as z
2572
2751
  };
2573
- //# sourceMappingURL=useQuery-NQNva6kg.js.map
2752
+ //# sourceMappingURL=useQuery-CPx0Im8Z.js.map