react-router 0.0.0-experimental-1d760f6a6 → 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-QBMD7MNB.mjs → chunk-YFJEQYI5.mjs} +63 -34
  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 -6095
  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 +63 -34
  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-DSJGM2GU.mjs → chunk-257QFYRX.mjs} +63 -34
  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 -6095
  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 +63 -34
  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-1d760f6a6
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,
@@ -6525,7 +6531,8 @@ async function singleFetchLoaderNavigationStrategy(args, router, getRouteInfo, f
6525
6531
  )
6526
6532
  );
6527
6533
  await Promise.all(routeDfds.map((d) => d.promise));
6528
- if ((!router.state.initialized || routesParams.size === 0) && !window.__reactRouterHdrActive) {
6534
+ let isInitialLoad = !router.state.initialized && router.state.navigation.state === "idle";
6535
+ if ((isInitialLoad || routesParams.size === 0) && !window.__reactRouterHdrActive) {
6529
6536
  singleFetchDfd.resolve({ routes: {} });
6530
6537
  } else {
6531
6538
  let targetRoutes = ssr && foundOptOutRoute && routesParams.size > 0 ? [...routesParams.keys()] : void 0;
@@ -7267,8 +7274,8 @@ var nextPaths = /* @__PURE__ */ new Set();
7267
7274
  var discoveredPathsMaxSize = 1e3;
7268
7275
  var discoveredPaths = /* @__PURE__ */ new Set();
7269
7276
  var URL_LIMIT = 7680;
7270
- function isFogOfWarEnabled(ssr) {
7271
- return ssr === true;
7277
+ function isFogOfWarEnabled(routeDiscovery, ssr) {
7278
+ return routeDiscovery.mode === "lazy" && ssr === true;
7272
7279
  }
7273
7280
  function getPartialManifest({ sri, ...manifest }, router) {
7274
7281
  let routeIds = new Set(router.state.matches.map((m) => m.route.id));
@@ -7295,8 +7302,8 @@ function getPartialManifest({ sri, ...manifest }, router) {
7295
7302
  sri: sri ? true : void 0
7296
7303
  };
7297
7304
  }
7298
- function getPatchRoutesOnNavigationFunction(manifest, routeModules, ssr, isSpaMode, basename) {
7299
- if (!isFogOfWarEnabled(ssr)) {
7305
+ function getPatchRoutesOnNavigationFunction(manifest, routeModules, ssr, routeDiscovery, isSpaMode, basename) {
7306
+ if (!isFogOfWarEnabled(routeDiscovery, ssr)) {
7300
7307
  return void 0;
7301
7308
  }
7302
7309
  return async ({ path, patch, signal, fetcherKey }) => {
@@ -7311,14 +7318,15 @@ function getPatchRoutesOnNavigationFunction(manifest, routeModules, ssr, isSpaMo
7311
7318
  ssr,
7312
7319
  isSpaMode,
7313
7320
  basename,
7321
+ routeDiscovery.manifestPath,
7314
7322
  patch,
7315
7323
  signal
7316
7324
  );
7317
7325
  };
7318
7326
  }
7319
- function useFogOFWarDiscovery(router, manifest, routeModules, ssr, isSpaMode) {
7327
+ function useFogOFWarDiscovery(router, manifest, routeModules, ssr, routeDiscovery, isSpaMode) {
7320
7328
  React8.useEffect(() => {
7321
- if (!isFogOfWarEnabled(ssr) || navigator.connection?.saveData === true) {
7329
+ if (!isFogOfWarEnabled(routeDiscovery, ssr) || navigator.connection?.saveData === true) {
7322
7330
  return;
7323
7331
  }
7324
7332
  function registerElement(el) {
@@ -7352,6 +7360,7 @@ function useFogOFWarDiscovery(router, manifest, routeModules, ssr, isSpaMode) {
7352
7360
  ssr,
7353
7361
  isSpaMode,
7354
7362
  router.basename,
7363
+ routeDiscovery.manifestPath,
7355
7364
  router.patchRoutes
7356
7365
  );
7357
7366
  } catch (e) {
@@ -7368,15 +7377,21 @@ function useFogOFWarDiscovery(router, manifest, routeModules, ssr, isSpaMode) {
7368
7377
  attributeFilter: ["data-discover", "href", "action"]
7369
7378
  });
7370
7379
  return () => observer.disconnect();
7371
- }, [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, "/");
7372
7388
  }
7373
7389
  var MANIFEST_VERSION_STORAGE_KEY = "react-router-manifest-version";
7374
- async function fetchAndApplyManifestPatches(paths, errorReloadPath, manifest, routeModules, ssr, isSpaMode, basename, patchRoutes, signal) {
7375
- let manifestPath = `${basename != null ? basename : "/"}/__manifest`.replace(
7376
- /\/+/g,
7377
- "/"
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
7378
7394
  );
7379
- let url = new URL(manifestPath, window.location.origin);
7380
7395
  paths.sort().forEach((path) => url.searchParams.append("p", path));
7381
7396
  url.searchParams.set("version", manifest.version);
7382
7397
  if (url.toString().length > URL_LIMIT) {
@@ -7403,7 +7418,9 @@ async function fetchAndApplyManifestPatches(paths, errorReloadPath, manifest, ro
7403
7418
  }
7404
7419
  sessionStorage.setItem(MANIFEST_VERSION_STORAGE_KEY, manifest.version);
7405
7420
  window.location.href = errorReloadPath;
7406
- throw new Error("Detected manifest version mismatch, reloading...");
7421
+ console.warn("Detected manifest version mismatch, reloading...");
7422
+ await new Promise(() => {
7423
+ });
7407
7424
  } else if (res.status >= 400) {
7408
7425
  throw new Error(await res.text());
7409
7426
  }
@@ -7782,10 +7799,17 @@ function isValidMetaTag(tagName) {
7782
7799
  }
7783
7800
  var isHydrated = false;
7784
7801
  function Scripts(props) {
7785
- let { manifest, serverHandoffString, isSpaMode, ssr, renderMeta } = useFrameworkContext();
7802
+ let {
7803
+ manifest,
7804
+ serverHandoffString,
7805
+ isSpaMode,
7806
+ renderMeta,
7807
+ routeDiscovery,
7808
+ ssr
7809
+ } = useFrameworkContext();
7786
7810
  let { router, static: isStatic, staticContext } = useDataRouterContext2();
7787
7811
  let { matches: routerMatches } = useDataRouterStateContext();
7788
- let enableFogOfWar = isFogOfWarEnabled(ssr);
7812
+ let enableFogOfWar = isFogOfWarEnabled(routeDiscovery, ssr);
7789
7813
  if (renderMeta) {
7790
7814
  renderMeta.didRenderScripts = true;
7791
7815
  }
@@ -7941,7 +7965,7 @@ function mergeRefs(...refs) {
7941
7965
  var isBrowser = typeof window !== "undefined" && typeof window.document !== "undefined" && typeof window.document.createElement !== "undefined";
7942
7966
  try {
7943
7967
  if (isBrowser) {
7944
- window.__reactRouterVersion = "0.0.0-experimental-1d760f6a6";
7968
+ window.__reactRouterVersion = "0.0.0-experimental-b2bc694a6";
7945
7969
  }
7946
7970
  } catch (e) {
7947
7971
  }
@@ -9065,6 +9089,7 @@ function ServerRouter({
9065
9089
  future: context.future,
9066
9090
  ssr: context.ssr,
9067
9091
  isSpaMode: context.isSpaMode,
9092
+ routeDiscovery: context.routeDiscovery,
9068
9093
  serializeError: context.serializeError,
9069
9094
  renderMeta: context.renderMeta
9070
9095
  }
@@ -9114,7 +9139,8 @@ function createRoutesStub(routes, unstable_getContext) {
9114
9139
  },
9115
9140
  routeModules: {},
9116
9141
  ssr: false,
9117
- isSpaMode: false
9142
+ isSpaMode: false,
9143
+ routeDiscovery: { mode: "lazy", manifestPath: "/__manifest" }
9118
9144
  };
9119
9145
  let patched = processRoutes(
9120
9146
  // @ts-expect-error `StubRouteObject` is stricter about `loader`/`action`
@@ -10083,7 +10109,10 @@ Error: ${e instanceof Error ? e.toString() : e}`
10083
10109
  }
10084
10110
  }
10085
10111
  }
10086
- let manifestUrl = `${normalizedBasename}/__manifest`.replace(/\/+/g, "/");
10112
+ let manifestUrl = getManifestPath(
10113
+ _build.routeDiscovery.manifestPath,
10114
+ normalizedBasename
10115
+ );
10087
10116
  if (url.pathname === manifestUrl) {
10088
10117
  try {
10089
10118
  let res = await handleManifestRequest(_build, routes, url);
@@ -10093,7 +10122,7 @@ Error: ${e instanceof Error ? e.toString() : e}`
10093
10122
  return new Response("Unknown Server Error", { status: 500 });
10094
10123
  }
10095
10124
  }
10096
- let matches = matchServerRoutes(routes, url.pathname, _build.basename);
10125
+ let matches = matchServerRoutes(routes, normalizedPath, _build.basename);
10097
10126
  if (matches && matches.length > 0) {
10098
10127
  Object.assign(params, matches[0].params);
10099
10128
  }
@@ -10281,17 +10310,21 @@ async function handleDocumentRequest(serverMode, build, staticHandler, request,
10281
10310
  actionData: context.actionData,
10282
10311
  errors: serializeErrors2(context.errors, serverMode)
10283
10312
  };
10313
+ let baseServerHandoff = {
10314
+ basename: build.basename,
10315
+ future: build.future,
10316
+ routeDiscovery: build.routeDiscovery,
10317
+ ssr: build.ssr,
10318
+ isSpaMode: isSpaMode2
10319
+ };
10284
10320
  let entryContext = {
10285
10321
  manifest: build.assets,
10286
10322
  routeModules: createEntryRouteModules(build.routes),
10287
10323
  staticHandlerContext: context,
10288
10324
  criticalCss,
10289
10325
  serverHandoffString: createServerHandoffString({
10290
- basename: build.basename,
10291
- criticalCss,
10292
- future: build.future,
10293
- ssr: build.ssr,
10294
- isSpaMode: isSpaMode2
10326
+ ...baseServerHandoff,
10327
+ criticalCss
10295
10328
  }),
10296
10329
  serverHandoffStream: encodeViaTurboStream(
10297
10330
  state,
@@ -10302,6 +10335,7 @@ async function handleDocumentRequest(serverMode, build, staticHandler, request,
10302
10335
  renderMeta: {},
10303
10336
  future: build.future,
10304
10337
  ssr: build.ssr,
10338
+ routeDiscovery: build.routeDiscovery,
10305
10339
  isSpaMode: isSpaMode2,
10306
10340
  serializeError: (err) => serializeError(err, serverMode)
10307
10341
  };
@@ -10344,12 +10378,7 @@ async function handleDocumentRequest(serverMode, build, staticHandler, request,
10344
10378
  entryContext = {
10345
10379
  ...entryContext,
10346
10380
  staticHandlerContext: context,
10347
- serverHandoffString: createServerHandoffString({
10348
- basename: build.basename,
10349
- future: build.future,
10350
- ssr: build.ssr,
10351
- isSpaMode: isSpaMode2
10352
- }),
10381
+ serverHandoffString: createServerHandoffString(baseServerHandoff),
10353
10382
  serverHandoffStream: encodeViaTurboStream(
10354
10383
  state2,
10355
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;