gemi 0.206.0 → 0.207.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.
- package/dist/{chunk-qjk68wda.js → chunk-53fv4c39.js} +2 -2
- package/dist/{chunk-qjk68wda.js.map → chunk-53fv4c39.js.map} +4 -4
- package/dist/{chunk-jr5t2hrk.js → chunk-b1v4ync4.js} +1 -1
- package/dist/{chunk-s4tq4y69.js → chunk-j683qspe.js} +1 -1
- package/dist/{chunk-j9ga7b74.js → chunk-k8a41gkt.js} +1 -1
- package/dist/{chunk-xmpamj50.js → chunk-yqgyywpq.js} +2 -2
- package/dist/{chunk-xmpamj50.js.map → chunk-yqgyywpq.js.map} +1 -1
- package/dist/chunks/{RealtimeClient-CLXePUcE.js → RealtimeClient-D4qIHPf1.js} +2 -2
- package/dist/chunks/{RealtimeClient-CLXePUcE.js.map → RealtimeClient-D4qIHPf1.js.map} +1 -1
- package/dist/chunks/{ThemeProvider-COjYIalw.js → ThemeProvider-w_axEu6B.js} +48 -9
- package/dist/chunks/ThemeProvider-w_axEu6B.js.map +1 -0
- package/dist/chunks/{fetchFileRequest-BaufNZpI.js → fetchFileRequest-Bhh5BC_l.js} +2 -2
- package/dist/chunks/{fetchFileRequest-BaufNZpI.js.map → fetchFileRequest-Bhh5BC_l.js.map} +1 -1
- package/dist/chunks/{live-Dz_rk7fm.js → live-9IXFtoGy.js} +3 -3
- package/dist/chunks/{live-Dz_rk7fm.js.map → live-9IXFtoGy.js.map} +1 -1
- package/dist/chunks/{mutationExtras-DtSw6BcX.js → mutationExtras-bNF9JOSk.js} +2 -2
- package/dist/chunks/{mutationExtras-DtSw6BcX.js.map → mutationExtras-bNF9JOSk.js.map} +1 -1
- package/dist/chunks/{subscriptionStream-CqhJOfPn.js → subscriptionStream-D42DpDiZ.js} +2 -2
- package/dist/chunks/{subscriptionStream-CqhJOfPn.js.map → subscriptionStream-D42DpDiZ.js.map} +1 -1
- package/dist/client/QueryManagerContext.d.ts +5 -1
- package/dist/client/QueryManagerContext.d.ts.map +1 -1
- package/dist/client/QueryResource.d.ts +27 -1
- package/dist/client/QueryResource.d.ts.map +1 -1
- package/dist/client/index.js +55 -15
- package/dist/client/index.js.map +1 -1
- package/dist/client/useMultipleQuery.d.ts +11 -1
- package/dist/client/useMultipleQuery.d.ts.map +1 -1
- package/dist/client/useQuery.d.ts +12 -1
- package/dist/client/useQuery.d.ts.map +1 -1
- package/dist/facades/index.js +1 -1
- package/dist/http/index.js +1 -1
- package/dist/i18n/index.js +1 -1
- package/dist/kernel/index.js +1 -1
- package/dist/server/index.js +1 -1
- package/dist/services/index.js +1 -1
- package/dist/testing/index.js +2 -2
- package/package.json +1 -1
- package/skills/gemi-react-best-practices/rules/query-multiple-query-per-component.md +22 -0
- package/dist/chunks/ThemeProvider-COjYIalw.js.map +0 -1
- /package/dist/{chunk-jr5t2hrk.js.map → chunk-b1v4ync4.js.map} +0 -0
- /package/dist/{chunk-s4tq4y69.js.map → chunk-j683qspe.js.map} +0 -0
- /package/dist/{chunk-j9ga7b74.js.map → chunk-k8a41gkt.js.map} +0 -0
|
@@ -399,6 +399,13 @@ var QueryResource = class {
|
|
|
399
399
|
* disconnect through `req.signal`.
|
|
400
400
|
*/
|
|
401
401
|
controllers = /* @__PURE__ */ new Map();
|
|
402
|
+
/**
|
|
403
|
+
* Variants whose data came from a streamed server payload (#1253). A reader
|
|
404
|
+
* that does not suspend rendered them on the server before their answer
|
|
405
|
+
* existed, so hydration must render them the same way; see
|
|
406
|
+
* `peekForHydration`.
|
|
407
|
+
*/
|
|
408
|
+
streamed = /* @__PURE__ */ new Set();
|
|
402
409
|
constructor(key, initialState) {
|
|
403
410
|
this.key = key;
|
|
404
411
|
this.store = new Subject(/* @__PURE__ */ new Map());
|
|
@@ -412,7 +419,7 @@ var QueryResource = class {
|
|
|
412
419
|
* otherwise the resource cache (which is keyed by path for the lifetime of
|
|
413
420
|
* the app) would keep serving the first payload and revalidate it over `/api`.
|
|
414
421
|
*/
|
|
415
|
-
hydrate(initialState) {
|
|
422
|
+
hydrate(initialState, streamed = false) {
|
|
416
423
|
const store = this.store.getValue();
|
|
417
424
|
const now = Date.now();
|
|
418
425
|
let changed = false;
|
|
@@ -422,6 +429,7 @@ var QueryResource = class {
|
|
|
422
429
|
if (current?.loading) continue;
|
|
423
430
|
if (current?.hasData && current.data === data) continue;
|
|
424
431
|
this.fill(store, variantKey, data, now);
|
|
432
|
+
if (streamed) this.streamed.add(variantKey);
|
|
425
433
|
changed = true;
|
|
426
434
|
}
|
|
427
435
|
if (changed) this.store.next(store);
|
|
@@ -467,6 +475,34 @@ var QueryResource = class {
|
|
|
467
475
|
return this.store.getValue().get(variantKey);
|
|
468
476
|
}
|
|
469
477
|
/**
|
|
478
|
+
* The server snapshot of a reader that does not suspend. On the server it
|
|
479
|
+
* rendered only what the document's `__GEMI_DATA__` carried, never a
|
|
480
|
+
* streamed answer (its request may still have been on the wire), so while
|
|
481
|
+
* hydrating it leaves out data that arrived through the stream. React
|
|
482
|
+
* re-renders with `peek` right after hydrating.
|
|
483
|
+
*/
|
|
484
|
+
peekForHydration(variantKey) {
|
|
485
|
+
return this.streamed.has(variantKey) ? void 0 : this.peek(variantKey);
|
|
486
|
+
}
|
|
487
|
+
/** Whether a request for this variant is on the wire. */
|
|
488
|
+
isFetching(variantKey) {
|
|
489
|
+
return this.inflight.has(variantKey);
|
|
490
|
+
}
|
|
491
|
+
/**
|
|
492
|
+
* The render-phase start for a reader that does not suspend (#1253): a
|
|
493
|
+
* variant with nothing cached and no request on the wire starts its request
|
|
494
|
+
* now, so it runs alongside the suspending reads of the same render instead
|
|
495
|
+
* of waiting for the commit's effect. Silent, like `read`: it never writes
|
|
496
|
+
* the store synchronously, and the in-flight mark makes every later read
|
|
497
|
+
* and the mount effect's `getVariant` join it.
|
|
498
|
+
*/
|
|
499
|
+
start(variantKey) {
|
|
500
|
+
if (typeof window === "undefined") return;
|
|
501
|
+
if (this.store.getValue().has(variantKey)) return;
|
|
502
|
+
if (this.inflight.has(variantKey)) return;
|
|
503
|
+
this.resolveVariant(variantKey, true);
|
|
504
|
+
}
|
|
505
|
+
/**
|
|
470
506
|
* The read a render performs. Never suspends when data is in hand (stale
|
|
471
507
|
* data revalidates in the background instead), dedupes across the render
|
|
472
508
|
* attempts React throws away, and hands back a promise that resolves off
|
|
@@ -903,13 +939,16 @@ function createQueryManager() {
|
|
|
903
939
|
}
|
|
904
940
|
return resource;
|
|
905
941
|
},
|
|
906
|
-
hydrate(prefetchedData) {
|
|
942
|
+
hydrate(prefetchedData, streamed = false) {
|
|
907
943
|
if (!prefetchedData) return;
|
|
908
944
|
for (const [key, initialState] of Object.entries(prefetchedData)) {
|
|
909
945
|
if (!initialState || typeof initialState !== "object") continue;
|
|
910
|
-
|
|
911
|
-
if (resource)
|
|
912
|
-
|
|
946
|
+
let resource = resources.get(key);
|
|
947
|
+
if (!resource) {
|
|
948
|
+
resource = new QueryResource(key, {});
|
|
949
|
+
resources.set(key, resource);
|
|
950
|
+
}
|
|
951
|
+
resource.hydrate(initialState, streamed);
|
|
913
952
|
}
|
|
914
953
|
},
|
|
915
954
|
clearErrors() {
|
|
@@ -943,7 +982,7 @@ var QueryManagerProvider = ({ children, queryConfig = null }) => {
|
|
|
943
982
|
drainedStreamRef.current = true;
|
|
944
983
|
const w = window;
|
|
945
984
|
const adopt = ([path, variantKey, data]) => {
|
|
946
|
-
hydrate({ [path]: { [variantKey]: data } });
|
|
985
|
+
hydrate({ [path]: { [variantKey]: data } }, true);
|
|
947
986
|
};
|
|
948
987
|
const buffered = Array.isArray(w.__GEMI_STREAM__) ? w.__GEMI_STREAM__ : [];
|
|
949
988
|
w.__GEMI_STREAM__ = { push: adopt };
|
|
@@ -1053,7 +1092,7 @@ function loadedRealtimeClient() {
|
|
|
1053
1092
|
}
|
|
1054
1093
|
var loading = null;
|
|
1055
1094
|
/** The lazily loaded client. Replaceable in tests, to simulate a failed load. */
|
|
1056
|
-
var lazyModules = { client: () => import("./RealtimeClient-
|
|
1095
|
+
var lazyModules = { client: () => import("./RealtimeClient-D4qIHPf1.js") };
|
|
1057
1096
|
/**
|
|
1058
1097
|
* `./live`, loaded by the first live query. `<Page>` in `gemi/testing` sets
|
|
1059
1098
|
* `current` up front, so a live query on a provided socket subscribes during
|
|
@@ -1061,7 +1100,7 @@ var lazyModules = { client: () => import("./RealtimeClient-CLXePUcE.js") };
|
|
|
1061
1100
|
*/
|
|
1062
1101
|
var liveModule = {
|
|
1063
1102
|
current: null,
|
|
1064
|
-
load: () => import("./live-
|
|
1103
|
+
load: () => import("./live-9IXFtoGy.js").then((n) => n.n)
|
|
1065
1104
|
};
|
|
1066
1105
|
/**
|
|
1067
1106
|
* The tab's client, loading its module and creating it on first use. `null`
|
|
@@ -3123,4 +3162,4 @@ function useTheme() {
|
|
|
3123
3162
|
//#endregion
|
|
3124
3163
|
export { applyParams as $, useSearchParams as A, loadURLPattern as B, loadDictionary as C, readRoutePayload as D, setActiveLocale as E, ServerDataProvider as F, configureRealtime as G, applyDocumentNonce as H, useLocation as I, realtime as J, followLive as K, domainUrl as L, I18nContext as M, I18nProvider as N, routeDataUrl as O, ServerDataContext as P, toVariantKey as Q, isAbsoluteUrl as R, recoverFromChunkLoadError as S, registerDictionary as T, useCspNonce as U, CspNonceContext as V, RealtimeContext as W, loadLazy as X, reconnectRealtime as Y, loadedModule as Z, configureChunkLoadRecovery as _, retryDelayFor as _t, useRouteTransition as a, DEFAULT_STALE_TIME as at, otherBuild as b, Subject as bt, ClientRouterContext as c, resetAuthenticationIncident as ct, ComponentsContext as d, isExternalRedirect as dt, QueryConfigContext as et, ComponentsProvider as f, safeRedirectPath as ft, CHUNK_RELOAD_MARKER as g, parseRetryAfter as gt, subscribeViewModules as h, isRetryableQueryError as ht, RouteTransitionProvider as i, pickDefined as it, useNavigate as j, useRoute as k, ClientRouterProvider as l, setAuthenticationNavigator as lt, loadViewModule as m, equalJitter as mt, useTheme as n, QueryManagerProvider as nt, useChannelSubscription as o, configureAuthenticationErrors as ot, initialViewModulesReady as p, readResponseBody as pt, liveModule as q, m as r, USER_QUERY_CONFIG_KEYS as rt, useCoalesced as s, reportAuthenticationRefusal as st, ThemeProvider as t, QueryManagerContext as tt, restoreScroll as u, INTENDED_URL_PARAM as ut, isChunkLoadError as v, shouldRetryQuery as vt, loadDictionaryForRender as w, recoverFromBuildMismatch as x, navigationStarted as y, QueryError as yt, ProgressManager as z };
|
|
3125
3164
|
|
|
3126
|
-
//# sourceMappingURL=ThemeProvider-
|
|
3165
|
+
//# sourceMappingURL=ThemeProvider-w_axEu6B.js.map
|