react-router 0.0.0-experimental-701a32801 → 0.0.0-experimental-b2bc694a6

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 (40) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/dist/development/{chunk-U5EFOURB.mjs → chunk-YFJEQYI5.mjs} +61 -33
  3. package/dist/development/dom-export.d.mts +2 -2
  4. package/dist/development/dom-export.d.ts +1 -2
  5. package/dist/development/dom-export.js +34 -6096
  6. package/dist/development/dom-export.mjs +6 -3
  7. package/dist/{production/fog-of-war-BLArG-qZ.d.ts → development/fog-of-war-B1MWugqW.d.mts} +59 -4
  8. package/dist/development/index.d.mts +7 -58
  9. package/dist/development/index.d.ts +1877 -188
  10. package/dist/development/index.js +61 -33
  11. package/dist/development/index.mjs +2 -2
  12. package/dist/development/lib/types/route-module.d.mts +1 -2
  13. package/dist/development/lib/types/route-module.d.ts +1 -2
  14. package/dist/development/lib/types/route-module.js +1 -1
  15. package/dist/development/lib/types/route-module.mjs +1 -1
  16. package/dist/{production/route-data-C12CLHiN.d.mts → development/route-data-BvrN3Sw4.d.mts} +11 -1
  17. package/dist/development/{route-data-C12CLHiN.d.mts → route-data-fNWkI-4T.d.ts} +11 -1
  18. package/dist/production/{chunk-HS7MHK7W.mjs → chunk-257QFYRX.mjs} +61 -33
  19. package/dist/production/dom-export.d.mts +2 -2
  20. package/dist/production/dom-export.d.ts +1 -2
  21. package/dist/production/dom-export.js +34 -6096
  22. package/dist/production/dom-export.mjs +6 -3
  23. package/dist/{development/fog-of-war-BLArG-qZ.d.ts → production/fog-of-war-B1MWugqW.d.mts} +59 -4
  24. package/dist/production/index.d.mts +7 -58
  25. package/dist/production/index.d.ts +1877 -188
  26. package/dist/production/index.js +61 -33
  27. package/dist/production/index.mjs +2 -2
  28. package/dist/production/lib/types/route-module.d.mts +1 -2
  29. package/dist/production/lib/types/route-module.d.ts +1 -2
  30. package/dist/production/lib/types/route-module.js +1 -1
  31. package/dist/production/lib/types/route-module.mjs +1 -1
  32. package/dist/{development/route-data-C12CLHiN.d.ts → production/route-data-BvrN3Sw4.d.mts} +11 -1
  33. package/dist/production/{route-data-C12CLHiN.d.ts → route-data-fNWkI-4T.d.ts} +11 -1
  34. package/package.json +1 -1
  35. package/dist/development/data-CQbyyGzl.d.mts +0 -11
  36. package/dist/development/data-CQbyyGzl.d.ts +0 -11
  37. package/dist/development/fog-of-war-D2zsXvum.d.mts +0 -1691
  38. package/dist/production/data-CQbyyGzl.d.mts +0 -11
  39. package/dist/production/data-CQbyyGzl.d.ts +0 -11
  40. package/dist/production/fog-of-war-D2zsXvum.d.mts +0 -1691
package/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # `react-router`
2
2
 
3
+ ## 7.5.3
4
+
5
+ ### Patch Changes
6
+
7
+ - Fix bug where bubbled action errors would result in `loaderData` being cleared at the handling `ErrorBoundary` route ([#13476](https://github.com/remix-run/react-router/pull/13476))
8
+ - Handle redirects from `clientLoader.hydrate` initial load executions ([#13477](https://github.com/remix-run/react-router/pull/13477))
9
+
3
10
  ## 7.5.2
4
11
 
5
12
  ### Patch Changes
@@ -1,5 +1,5 @@
1
1
  /**
2
- * react-router v0.0.0-experimental-701a32801
2
+ * react-router v0.0.0-experimental-b2bc694a6
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -1590,7 +1590,11 @@ function createRouter(init) {
1590
1590
  }
1591
1591
  return {
1592
1592
  matches,
1593
- pendingActionResult: [boundaryMatch.route.id, result]
1593
+ pendingActionResult: [
1594
+ boundaryMatch.route.id,
1595
+ result,
1596
+ actionMatch.route.id
1597
+ ]
1594
1598
  };
1595
1599
  }
1596
1600
  return {
@@ -4361,7 +4365,9 @@ function processRouteLoaderData(matches, results, pendingActionResult, isStaticH
4361
4365
  });
4362
4366
  if (pendingError !== void 0 && pendingActionResult) {
4363
4367
  errors = { [pendingActionResult[0]]: pendingError };
4364
- loaderData[pendingActionResult[0]] = void 0;
4368
+ if (pendingActionResult[2]) {
4369
+ loaderData[pendingActionResult[2]] = void 0;
4370
+ }
4365
4371
  }
4366
4372
  return {
4367
4373
  loaderData,
@@ -7268,8 +7274,8 @@ var nextPaths = /* @__PURE__ */ new Set();
7268
7274
  var discoveredPathsMaxSize = 1e3;
7269
7275
  var discoveredPaths = /* @__PURE__ */ new Set();
7270
7276
  var URL_LIMIT = 7680;
7271
- function isFogOfWarEnabled(ssr) {
7272
- return ssr === true;
7277
+ function isFogOfWarEnabled(routeDiscovery, ssr) {
7278
+ return routeDiscovery.mode === "lazy" && ssr === true;
7273
7279
  }
7274
7280
  function getPartialManifest({ sri, ...manifest }, router) {
7275
7281
  let routeIds = new Set(router.state.matches.map((m) => m.route.id));
@@ -7296,8 +7302,8 @@ function getPartialManifest({ sri, ...manifest }, router) {
7296
7302
  sri: sri ? true : void 0
7297
7303
  };
7298
7304
  }
7299
- function getPatchRoutesOnNavigationFunction(manifest, routeModules, ssr, isSpaMode, basename) {
7300
- if (!isFogOfWarEnabled(ssr)) {
7305
+ function getPatchRoutesOnNavigationFunction(manifest, routeModules, ssr, routeDiscovery, isSpaMode, basename) {
7306
+ if (!isFogOfWarEnabled(routeDiscovery, ssr)) {
7301
7307
  return void 0;
7302
7308
  }
7303
7309
  return async ({ path, patch, signal, fetcherKey }) => {
@@ -7312,14 +7318,15 @@ function getPatchRoutesOnNavigationFunction(manifest, routeModules, ssr, isSpaMo
7312
7318
  ssr,
7313
7319
  isSpaMode,
7314
7320
  basename,
7321
+ routeDiscovery.manifestPath,
7315
7322
  patch,
7316
7323
  signal
7317
7324
  );
7318
7325
  };
7319
7326
  }
7320
- function useFogOFWarDiscovery(router, manifest, routeModules, ssr, isSpaMode) {
7327
+ function useFogOFWarDiscovery(router, manifest, routeModules, ssr, routeDiscovery, isSpaMode) {
7321
7328
  React8.useEffect(() => {
7322
- if (!isFogOfWarEnabled(ssr) || navigator.connection?.saveData === true) {
7329
+ if (!isFogOfWarEnabled(routeDiscovery, ssr) || navigator.connection?.saveData === true) {
7323
7330
  return;
7324
7331
  }
7325
7332
  function registerElement(el) {
@@ -7353,6 +7360,7 @@ function useFogOFWarDiscovery(router, manifest, routeModules, ssr, isSpaMode) {
7353
7360
  ssr,
7354
7361
  isSpaMode,
7355
7362
  router.basename,
7363
+ routeDiscovery.manifestPath,
7356
7364
  router.patchRoutes
7357
7365
  );
7358
7366
  } catch (e) {
@@ -7369,15 +7377,21 @@ function useFogOFWarDiscovery(router, manifest, routeModules, ssr, isSpaMode) {
7369
7377
  attributeFilter: ["data-discover", "href", "action"]
7370
7378
  });
7371
7379
  return () => observer.disconnect();
7372
- }, [ssr, isSpaMode, manifest, routeModules, router]);
7380
+ }, [ssr, isSpaMode, manifest, routeModules, router, routeDiscovery]);
7381
+ }
7382
+ function getManifestPath(_manifestPath, basename) {
7383
+ let manifestPath = _manifestPath || "/__manifest";
7384
+ if (basename == null) {
7385
+ return manifestPath;
7386
+ }
7387
+ return `${basename}${manifestPath}`.replace(/\/+/g, "/");
7373
7388
  }
7374
7389
  var MANIFEST_VERSION_STORAGE_KEY = "react-router-manifest-version";
7375
- async function fetchAndApplyManifestPatches(paths, errorReloadPath, manifest, routeModules, ssr, isSpaMode, basename, patchRoutes, signal) {
7376
- let manifestPath = `${basename != null ? basename : "/"}/__manifest`.replace(
7377
- /\/+/g,
7378
- "/"
7390
+ async function fetchAndApplyManifestPatches(paths, errorReloadPath, manifest, routeModules, ssr, isSpaMode, basename, manifestPath, patchRoutes, signal) {
7391
+ let url = new URL(
7392
+ getManifestPath(manifestPath, basename),
7393
+ window.location.origin
7379
7394
  );
7380
- let url = new URL(manifestPath, window.location.origin);
7381
7395
  paths.sort().forEach((path) => url.searchParams.append("p", path));
7382
7396
  url.searchParams.set("version", manifest.version);
7383
7397
  if (url.toString().length > URL_LIMIT) {
@@ -7404,7 +7418,9 @@ async function fetchAndApplyManifestPatches(paths, errorReloadPath, manifest, ro
7404
7418
  }
7405
7419
  sessionStorage.setItem(MANIFEST_VERSION_STORAGE_KEY, manifest.version);
7406
7420
  window.location.href = errorReloadPath;
7407
- throw new Error("Detected manifest version mismatch, reloading...");
7421
+ console.warn("Detected manifest version mismatch, reloading...");
7422
+ await new Promise(() => {
7423
+ });
7408
7424
  } else if (res.status >= 400) {
7409
7425
  throw new Error(await res.text());
7410
7426
  }
@@ -7783,10 +7799,17 @@ function isValidMetaTag(tagName) {
7783
7799
  }
7784
7800
  var isHydrated = false;
7785
7801
  function Scripts(props) {
7786
- let { manifest, serverHandoffString, isSpaMode, ssr, renderMeta } = useFrameworkContext();
7802
+ let {
7803
+ manifest,
7804
+ serverHandoffString,
7805
+ isSpaMode,
7806
+ renderMeta,
7807
+ routeDiscovery,
7808
+ ssr
7809
+ } = useFrameworkContext();
7787
7810
  let { router, static: isStatic, staticContext } = useDataRouterContext2();
7788
7811
  let { matches: routerMatches } = useDataRouterStateContext();
7789
- let enableFogOfWar = isFogOfWarEnabled(ssr);
7812
+ let enableFogOfWar = isFogOfWarEnabled(routeDiscovery, ssr);
7790
7813
  if (renderMeta) {
7791
7814
  renderMeta.didRenderScripts = true;
7792
7815
  }
@@ -7942,7 +7965,7 @@ function mergeRefs(...refs) {
7942
7965
  var isBrowser = typeof window !== "undefined" && typeof window.document !== "undefined" && typeof window.document.createElement !== "undefined";
7943
7966
  try {
7944
7967
  if (isBrowser) {
7945
- window.__reactRouterVersion = "0.0.0-experimental-701a32801";
7968
+ window.__reactRouterVersion = "0.0.0-experimental-b2bc694a6";
7946
7969
  }
7947
7970
  } catch (e) {
7948
7971
  }
@@ -9066,6 +9089,7 @@ function ServerRouter({
9066
9089
  future: context.future,
9067
9090
  ssr: context.ssr,
9068
9091
  isSpaMode: context.isSpaMode,
9092
+ routeDiscovery: context.routeDiscovery,
9069
9093
  serializeError: context.serializeError,
9070
9094
  renderMeta: context.renderMeta
9071
9095
  }
@@ -9115,7 +9139,8 @@ function createRoutesStub(routes, unstable_getContext) {
9115
9139
  },
9116
9140
  routeModules: {},
9117
9141
  ssr: false,
9118
- isSpaMode: false
9142
+ isSpaMode: false,
9143
+ routeDiscovery: { mode: "lazy", manifestPath: "/__manifest" }
9119
9144
  };
9120
9145
  let patched = processRoutes(
9121
9146
  // @ts-expect-error `StubRouteObject` is stricter about `loader`/`action`
@@ -10084,7 +10109,10 @@ Error: ${e instanceof Error ? e.toString() : e}`
10084
10109
  }
10085
10110
  }
10086
10111
  }
10087
- let manifestUrl = `${normalizedBasename}/__manifest`.replace(/\/+/g, "/");
10112
+ let manifestUrl = getManifestPath(
10113
+ _build.routeDiscovery.manifestPath,
10114
+ normalizedBasename
10115
+ );
10088
10116
  if (url.pathname === manifestUrl) {
10089
10117
  try {
10090
10118
  let res = await handleManifestRequest(_build, routes, url);
@@ -10094,7 +10122,7 @@ Error: ${e instanceof Error ? e.toString() : e}`
10094
10122
  return new Response("Unknown Server Error", { status: 500 });
10095
10123
  }
10096
10124
  }
10097
- let matches = matchServerRoutes(routes, url.pathname, _build.basename);
10125
+ let matches = matchServerRoutes(routes, normalizedPath, _build.basename);
10098
10126
  if (matches && matches.length > 0) {
10099
10127
  Object.assign(params, matches[0].params);
10100
10128
  }
@@ -10282,17 +10310,21 @@ async function handleDocumentRequest(serverMode, build, staticHandler, request,
10282
10310
  actionData: context.actionData,
10283
10311
  errors: serializeErrors2(context.errors, serverMode)
10284
10312
  };
10313
+ let baseServerHandoff = {
10314
+ basename: build.basename,
10315
+ future: build.future,
10316
+ routeDiscovery: build.routeDiscovery,
10317
+ ssr: build.ssr,
10318
+ isSpaMode: isSpaMode2
10319
+ };
10285
10320
  let entryContext = {
10286
10321
  manifest: build.assets,
10287
10322
  routeModules: createEntryRouteModules(build.routes),
10288
10323
  staticHandlerContext: context,
10289
10324
  criticalCss,
10290
10325
  serverHandoffString: createServerHandoffString({
10291
- basename: build.basename,
10292
- criticalCss,
10293
- future: build.future,
10294
- ssr: build.ssr,
10295
- isSpaMode: isSpaMode2
10326
+ ...baseServerHandoff,
10327
+ criticalCss
10296
10328
  }),
10297
10329
  serverHandoffStream: encodeViaTurboStream(
10298
10330
  state,
@@ -10303,6 +10335,7 @@ async function handleDocumentRequest(serverMode, build, staticHandler, request,
10303
10335
  renderMeta: {},
10304
10336
  future: build.future,
10305
10337
  ssr: build.ssr,
10338
+ routeDiscovery: build.routeDiscovery,
10306
10339
  isSpaMode: isSpaMode2,
10307
10340
  serializeError: (err) => serializeError(err, serverMode)
10308
10341
  };
@@ -10345,12 +10378,7 @@ async function handleDocumentRequest(serverMode, build, staticHandler, request,
10345
10378
  entryContext = {
10346
10379
  ...entryContext,
10347
10380
  staticHandlerContext: context,
10348
- serverHandoffString: createServerHandoffString({
10349
- basename: build.basename,
10350
- future: build.future,
10351
- ssr: build.ssr,
10352
- isSpaMode: isSpaMode2
10353
- }),
10381
+ serverHandoffString: createServerHandoffString(baseServerHandoff),
10354
10382
  serverHandoffStream: encodeViaTurboStream(
10355
10383
  state2,
10356
10384
  request.signal,
@@ -1,6 +1,6 @@
1
1
  import * as React from 'react';
2
- import { R as RouterProviderProps$1 } from './fog-of-war-D2zsXvum.mjs';
3
- import { R as RouterInit } from './route-data-C12CLHiN.mjs';
2
+ import { R as RouterProviderProps$1 } from './fog-of-war-B1MWugqW.mjs';
3
+ import { R as RouterInit } from './route-data-BvrN3Sw4.mjs';
4
4
 
5
5
  type RouterProviderProps = Omit<RouterProviderProps$1, "flushSync">;
6
6
  declare function RouterProvider(props: Omit<RouterProviderProps, "flushSync">): React.JSX.Element;
@@ -1,6 +1,5 @@
1
1
  import * as React from 'react';
2
- import { R as RouterProviderProps$1 } from './fog-of-war-BLArG-qZ.js';
3
- import { R as RouterInit } from './route-data-C12CLHiN.js';
2
+ import { RouterProviderProps as RouterProviderProps$1, RouterInit } from 'react-router';
4
3
 
5
4
  type RouterProviderProps = Omit<RouterProviderProps$1, "flushSync">;
6
5
  declare function RouterProvider(props: Omit<RouterProviderProps, "flushSync">): React.JSX.Element;