gemi 0.166.0 → 0.166.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.
Files changed (24) hide show
  1. package/dist/{chunk-k4asa3bz.js → chunk-8rnvw8xr.js} +2 -2
  2. package/dist/{chunk-k4asa3bz.js.map → chunk-8rnvw8xr.js.map} +1 -1
  3. package/dist/{chunk-vg53hn9x.js → chunk-f9nmn8x7.js} +4 -4
  4. package/dist/{chunk-vg53hn9x.js.map → chunk-f9nmn8x7.js.map} +3 -3
  5. package/dist/{chunk-xafdc093.js → chunk-fdfy25mv.js} +1 -1
  6. package/dist/chunks/{RealtimeClient-BX_HwEBK.js → RealtimeClient-DpAJYcF5.js} +2 -2
  7. package/dist/chunks/{RealtimeClient-BX_HwEBK.js.map → RealtimeClient-DpAJYcF5.js.map} +1 -1
  8. package/dist/chunks/{ThemeProvider-D4mhhONE.js → ThemeProvider-DAbL-cqC.js} +36 -8
  9. package/dist/chunks/{ThemeProvider-D4mhhONE.js.map → ThemeProvider-DAbL-cqC.js.map} +1 -1
  10. package/dist/chunks/{fetchFileRequest-C3wMigR3.js → fetchFileRequest-yAKa_pKx.js} +2 -2
  11. package/dist/chunks/{fetchFileRequest-C3wMigR3.js.map → fetchFileRequest-yAKa_pKx.js.map} +1 -1
  12. package/dist/chunks/{live-CJOuf1Gu.js → live-BvhWo-yY.js} +3 -3
  13. package/dist/chunks/{live-CJOuf1Gu.js.map → live-BvhWo-yY.js.map} +1 -1
  14. package/dist/chunks/{mutationExtras-DpB8MtNs.js → mutationExtras-_hbHxr6-.js} +2 -2
  15. package/dist/chunks/{mutationExtras-DpB8MtNs.js.map → mutationExtras-_hbHxr6-.js.map} +1 -1
  16. package/dist/client/ClientRouter.d.ts.map +1 -1
  17. package/dist/client/chunkLoadRecovery.d.ts +6 -0
  18. package/dist/client/chunkLoadRecovery.d.ts.map +1 -1
  19. package/dist/client/index.js +4 -3
  20. package/dist/client/index.js.map +1 -1
  21. package/dist/server/index.js +1 -1
  22. package/dist/testing/index.js +2 -2
  23. package/package.json +1 -1
  24. /package/dist/{chunk-xafdc093.js.map → chunk-fdfy25mv.js.map} +0 -0
@@ -796,7 +796,7 @@ function loadedRealtimeClient() {
796
796
  }
797
797
  var loading = null;
798
798
  /** The lazily loaded client. Replaceable in tests, to simulate a failed load. */
799
- var lazyModules = { client: () => import("./RealtimeClient-BX_HwEBK.js") };
799
+ var lazyModules = { client: () => import("./RealtimeClient-DpAJYcF5.js") };
800
800
  /**
801
801
  * `./live`, loaded by the first live query. `<Page>` in `gemi/testing` sets
802
802
  * `current` up front, so a live query on a provided socket subscribes during
@@ -804,7 +804,7 @@ var lazyModules = { client: () => import("./RealtimeClient-BX_HwEBK.js") };
804
804
  */
805
805
  var liveModule = {
806
806
  current: null,
807
- load: () => import("./live-CJOuf1Gu.js").then((n) => n.n)
807
+ load: () => import("./live-BvhWo-yY.js").then((n) => n.n)
808
808
  };
809
809
  /**
810
810
  * The tab's client, loading its module and creating it on first use. `null`
@@ -2998,7 +2998,20 @@ var CHUNK_RELOAD_MARKER = "gemi:chunk-reload";
2998
2998
  var BUILD_HEADER = "x-gemi-build";
2999
2999
  var enabled = true;
3000
3000
  var options = {};
3001
- var reloading = false;
3001
+ /**
3002
+ * The full load gemi started and the page is still waiting on: further
3003
+ * failures of the same navigation (a route with several views fails once per
3004
+ * view) report it as under way instead of starting another.
3005
+ *
3006
+ * Not a latch for the life of the page: the load can be cancelled — "Stay" on
3007
+ * a `beforeunload` prompt (a dirty editor), a handler that stops it — and the
3008
+ * page then keeps running with no load coming. It holds only for the
3009
+ * navigation that started it (`navigationStarted` clears it) and for the
3010
+ * cooldown, so a later failure is judged on its own: another URL loads in
3011
+ * full, the same URL inside the cooldown is refused (the data renders, the
3012
+ * view's error boundary shows), and after the cooldown it loads again.
3013
+ */
3014
+ var pendingLoad = null;
3002
3015
  /**
3003
3016
  * Sets how gemi recovers from a failed chunk. `false` turns recovery off: the
3004
3017
  * failure goes to the route's error boundary as it did before. `init` calls
@@ -3009,6 +3022,18 @@ function configureChunkLoadRecovery(next) {
3009
3022
  options = next || {};
3010
3023
  }
3011
3024
  /**
3025
+ * The router calls this as each client-side navigation starts. A full load
3026
+ * still pending from an earlier one was cancelled (the page would be gone
3027
+ * otherwise), so it no longer speaks for this navigation's failures.
3028
+ */
3029
+ function navigationStarted() {
3030
+ pendingLoad = null;
3031
+ }
3032
+ /** Whether a full load onto `url` is already under way. */
3033
+ function loadPending(url) {
3034
+ return pendingLoad !== null && pendingLoad.url === url && withinCooldown(Date.now() - pendingLoad.at, cooldownMs());
3035
+ }
3036
+ /**
3012
3037
  * Whether `error` is a module that failed to load rather than one that loaded
3013
3038
  * and threw. Each engine words it differently:
3014
3039
  *
@@ -3046,8 +3071,8 @@ var CHUNK_LOAD_MESSAGES = [
3046
3071
  */
3047
3072
  function recoverFromChunkLoadError(error, { source = "app", url } = {}) {
3048
3073
  if (typeof window === "undefined" || !enabled || !isChunkLoadError(error)) return false;
3049
- if (reloading) return true;
3050
3074
  const target = url ?? window.location.href;
3075
+ if (loadPending(target)) return true;
3051
3076
  const blocked = reloadBlock(target);
3052
3077
  if (options.onChunkLoadError?.({
3053
3078
  error,
@@ -3067,7 +3092,7 @@ function recoverFromChunkLoadError(error, { source = "app", url } = {}) {
3067
3092
  */
3068
3093
  function recoverFromBuildMismatch({ url, clientBuild, serverBuild }) {
3069
3094
  if (typeof window === "undefined" || !enabled) return false;
3070
- if (reloading) return true;
3095
+ if (loadPending(url)) return true;
3071
3096
  const blocked = reloadBlock(url);
3072
3097
  if (options.onBuildMismatch?.({
3073
3098
  url,
@@ -3088,7 +3113,10 @@ function otherBuild(response, clientBuild) {
3088
3113
  }
3089
3114
  function loadInFull(target, blocked) {
3090
3115
  if (blocked !== null || !markReload(target)) return false;
3091
- reloading = true;
3116
+ pendingLoad = {
3117
+ url: target,
3118
+ at: Date.now()
3119
+ };
3092
3120
  if (target === window.location.href) window.location.reload();
3093
3121
  else window.location.assign(target);
3094
3122
  return true;
@@ -3762,6 +3790,6 @@ function useTheme() {
3762
3790
  return useContext(ThemeContext);
3763
3791
  }
3764
3792
  //#endregion
3765
- export { USER_QUERY_CONFIG_KEYS as $, I18nContext as A, RealtimeContext as B, registerDictionary as C, useRoute as D, routeDataUrl as E, domainUrl as F, reconnectRealtime as G, followLive as H, isAbsoluteUrl as I, toVariantKey as J, loadLazy as K, ProgressManager as L, ServerDataContext as M, ServerDataProvider as N, useSearchParams as O, useLocation as P, QueryManagerProvider as Q, Action as R, loadDictionaryForRender as S, readRoutePayload as T, liveModule as U, configureRealtime as V, realtime as W, QueryConfigContext as X, applyParams as Y, QueryManagerContext as Z, isChunkLoadError as _, useRouteTransition as a, retryDelayFor as at, recoverFromChunkLoadError as b, ClientRouterContext as c, Subject as ct, ComponentsProvider as d, pickDefined as et, initialViewModulesReady as f, configureChunkLoadRecovery as g, CHUNK_RELOAD_MARKER as h, RouteTransitionProvider as i, parseRetryAfter as it, I18nProvider as j, useNavigate as k, ClientRouterProvider as l, subscribeViewModules as m, useTheme as n, readResponseBody as nt, useChannelSubscription as o, shouldRetryQuery as ot, loadViewModule as p, loadedModule as q, m as r, isRetryableQueryError as rt, useCoalesced as s, QueryError as st, ThemeProvider as t, DEFAULT_STALE_TIME as tt, ComponentsContext as u, otherBuild as v, setActiveLocale as w, loadDictionary as x, recoverFromBuildMismatch as y, createMemoryHistory as z };
3793
+ export { QueryManagerProvider as $, useNavigate as A, createMemoryHistory as B, loadDictionaryForRender as C, routeDataUrl as D, readRoutePayload as E, useLocation as F, realtime as G, configureRealtime as H, domainUrl as I, loadedModule as J, reconnectRealtime as K, isAbsoluteUrl as L, I18nProvider as M, ServerDataContext as N, useRoute as O, ServerDataProvider as P, QueryManagerContext as Q, ProgressManager as R, loadDictionary as S, setActiveLocale as T, followLive as U, RealtimeContext as V, liveModule as W, applyParams as X, toVariantKey as Y, QueryConfigContext as Z, isChunkLoadError as _, useRouteTransition as a, parseRetryAfter as at, recoverFromBuildMismatch as b, ClientRouterContext as c, QueryError as ct, ComponentsProvider as d, USER_QUERY_CONFIG_KEYS as et, initialViewModulesReady as f, configureChunkLoadRecovery as g, CHUNK_RELOAD_MARKER as h, RouteTransitionProvider as i, isRetryableQueryError as it, I18nContext as j, useSearchParams as k, ClientRouterProvider as l, Subject as lt, subscribeViewModules as m, useTheme as n, DEFAULT_STALE_TIME as nt, useChannelSubscription as o, retryDelayFor as ot, loadViewModule as p, loadLazy as q, m as r, readResponseBody as rt, useCoalesced as s, shouldRetryQuery as st, ThemeProvider as t, pickDefined as tt, ComponentsContext as u, navigationStarted as v, registerDictionary as w, recoverFromChunkLoadError as x, otherBuild as y, Action as z };
3766
3794
 
3767
- //# sourceMappingURL=ThemeProvider-D4mhhONE.js.map
3795
+ //# sourceMappingURL=ThemeProvider-DAbL-cqC.js.map