react-router 7.9.1-pre.0 → 7.9.2-pre.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.
Files changed (58) hide show
  1. package/CHANGELOG.md +19 -1
  2. package/dist/development/{chunk-XGGFIIA6.js → chunk-ED2JHW2I.js} +102 -70
  3. package/dist/development/{chunk-T2FO7LZR.mjs → chunk-EPSRV6KC.mjs} +64 -26
  4. package/dist/{production/chunk-CYDGAKF3.mjs → development/chunk-PVJ3J6E6.mjs} +94 -9
  5. package/dist/development/{chunk-XMMS4S5U.js → chunk-VM65TX2A.js} +138 -132
  6. package/dist/development/{context-CIdFp11b.d.mts → context-BqL5Eckq.d.mts} +20 -0
  7. package/dist/development/dom-export.d.mts +1 -1
  8. package/dist/development/dom-export.js +3 -3
  9. package/dist/development/dom-export.mjs +3 -3
  10. package/dist/development/{index-react-server-client-BeVfPpWg.d.mts → index-react-server-client-2EDmGlsZ.d.mts} +40 -24
  11. package/dist/{production/index-react-server-client-BYr9g50r.d.ts → development/index-react-server-client-DKvU8YRr.d.ts} +39 -23
  12. package/dist/development/index-react-server-client.d.mts +3 -3
  13. package/dist/development/index-react-server-client.d.ts +2 -2
  14. package/dist/development/index-react-server-client.js +4 -4
  15. package/dist/development/index-react-server-client.mjs +2 -2
  16. package/dist/development/index-react-server.d.mts +10 -0
  17. package/dist/development/index-react-server.d.ts +10 -0
  18. package/dist/development/index-react-server.js +3 -3
  19. package/dist/development/index-react-server.mjs +3 -3
  20. package/dist/development/index.d.mts +16 -12
  21. package/dist/development/index.d.ts +14 -10
  22. package/dist/development/index.js +190 -105
  23. package/dist/development/index.mjs +3 -3
  24. package/dist/development/lib/types/internal.d.mts +2 -2
  25. package/dist/development/lib/types/internal.d.ts +1 -1
  26. package/dist/development/lib/types/internal.js +1 -1
  27. package/dist/development/lib/types/internal.mjs +1 -1
  28. package/dist/development/{route-data-Bpm4liR_.d.mts → route-data-CDwqkzPE.d.mts} +1 -1
  29. package/dist/{production/routeModules-DnUHijGz.d.ts → development/routeModules-BmVo7q9e.d.ts} +20 -0
  30. package/dist/production/{chunk-CQNGOQ3L.js → chunk-22I2H6CR.js} +102 -70
  31. package/dist/production/{chunk-NVD2TNOP.mjs → chunk-662O2YDJ.mjs} +64 -26
  32. package/dist/{development/chunk-Y3WUXTM5.mjs → production/chunk-HAV7J4RO.mjs} +94 -9
  33. package/dist/production/{chunk-QSAZM6H2.js → chunk-K4BWIVAI.js} +138 -132
  34. package/dist/production/{context-CIdFp11b.d.mts → context-BqL5Eckq.d.mts} +20 -0
  35. package/dist/production/dom-export.d.mts +1 -1
  36. package/dist/production/dom-export.js +3 -3
  37. package/dist/production/dom-export.mjs +3 -3
  38. package/dist/production/{index-react-server-client-BeVfPpWg.d.mts → index-react-server-client-2EDmGlsZ.d.mts} +40 -24
  39. package/dist/{development/index-react-server-client-BYr9g50r.d.ts → production/index-react-server-client-DKvU8YRr.d.ts} +39 -23
  40. package/dist/production/index-react-server-client.d.mts +3 -3
  41. package/dist/production/index-react-server-client.d.ts +2 -2
  42. package/dist/production/index-react-server-client.js +4 -4
  43. package/dist/production/index-react-server-client.mjs +2 -2
  44. package/dist/production/index-react-server.d.mts +10 -0
  45. package/dist/production/index-react-server.d.ts +10 -0
  46. package/dist/production/index-react-server.js +3 -3
  47. package/dist/production/index-react-server.mjs +3 -3
  48. package/dist/production/index.d.mts +16 -12
  49. package/dist/production/index.d.ts +14 -10
  50. package/dist/production/index.js +190 -105
  51. package/dist/production/index.mjs +3 -3
  52. package/dist/production/lib/types/internal.d.mts +2 -2
  53. package/dist/production/lib/types/internal.d.ts +1 -1
  54. package/dist/production/lib/types/internal.js +1 -1
  55. package/dist/production/lib/types/internal.mjs +1 -1
  56. package/dist/production/{route-data-Bpm4liR_.d.mts → route-data-CDwqkzPE.d.mts} +1 -1
  57. package/dist/{development/routeModules-DnUHijGz.d.ts → production/routeModules-BmVo7q9e.d.ts} +20 -0
  58. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -1,6 +1,24 @@
1
1
  # `react-router`
2
2
 
3
- ## 7.9.1-pre.0
3
+ ## 7.9.2-pre.0
4
+
5
+ ### Patch Changes
6
+
7
+ - - Update client-side router to run client `middleware` on initial load even if no loaders exist ([#14348](https://github.com/remix-run/react-router/pull/14348))
8
+ - Update `createRoutesStub` to run route middleware
9
+ - You will need to set the `<RoutesStub future={{ v8_middleware: true }} />` flag to enable the proper `context` type
10
+ - Update Lazy Route Discovery manifest requests to use a singular comma-separated `paths` query param instead of repeated `p` query params ([#14321](https://github.com/remix-run/react-router/pull/14321))
11
+ - This is because Cloudflare has a hard limit of 100 URL search param key/value pairs when used as a key for caching purposes
12
+ - If more that 100 paths were included, the cache key would be incomplete and could produce false-positive cache hits
13
+
14
+ - [UNSTABLE] Add `fetcher.unstable_reset()` API ([#14206](https://github.com/remix-run/react-router/pull/14206))
15
+ - Made useOutlet element reference have stable identity in-between route chages ([#13382](https://github.com/remix-run/react-router/pull/13382))
16
+ - In RSC Data Mode, handle SSR'd client errors and re-try in the browser ([#14342](https://github.com/remix-run/react-router/pull/14342))
17
+ - Support `middleware` prop on `<Route>` for usage with a data router via `createRoutesFromElements` ([#14357](https://github.com/remix-run/react-router/pull/14357))
18
+ - Handle encoded question mark and hash characters in ancestor splat routes ([#14249](https://github.com/remix-run/react-router/pull/14249))
19
+ - Fail gracefully on manifest version mismatch logic if `sessionStorage` access is blocked ([#14335](https://github.com/remix-run/react-router/pull/14335))
20
+
21
+ ## 7.9.1
4
22
 
5
23
  ### Patch Changes
6
24
 
@@ -1,5 +1,5 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }/**
2
- * react-router v7.9.1-pre.0
2
+ * react-router v7.9.2-pre.0
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -1054,7 +1054,7 @@ function createRouter(init) {
1054
1054
  }
1055
1055
  } else if (initialMatches.some((m) => m.route.lazy)) {
1056
1056
  initialized = false;
1057
- } else if (!initialMatches.some((m) => m.route.loader)) {
1057
+ } else if (!initialMatches.some((m) => routeHasLoaderOrMiddleware(m.route))) {
1058
1058
  initialized = true;
1059
1059
  } else {
1060
1060
  let loaderData = init.hydrationData ? init.hydrationData.loaderData : null;
@@ -1756,7 +1756,9 @@ function createRouter(init) {
1756
1756
  pendingActionResult
1757
1757
  );
1758
1758
  pendingNavigationLoadId = ++incrementingLoadId;
1759
- if (!init.dataStrategy && !dsMatches.some((m) => m.shouldLoad) && !dsMatches.some((m) => m.route.middleware) && revalidatingFetchers.length === 0) {
1759
+ if (!init.dataStrategy && !dsMatches.some((m) => m.shouldLoad) && !dsMatches.some(
1760
+ (m) => m.route.middleware && m.route.middleware.length > 0
1761
+ ) && revalidatingFetchers.length === 0) {
1760
1762
  let updatedFetchers2 = markFetchRedirectsDone();
1761
1763
  completeNavigation(
1762
1764
  location,
@@ -2437,6 +2439,10 @@ function createRouter(init) {
2437
2439
  }
2438
2440
  return state.fetchers.get(key) || IDLE_FETCHER;
2439
2441
  }
2442
+ function resetFetcher(key, opts) {
2443
+ abortFetcher(key, _optionalChain([opts, 'optionalAccess', _15 => _15.reason]));
2444
+ updateFetcherState(key, getDoneFetcher(null));
2445
+ }
2440
2446
  function deleteFetcher(key) {
2441
2447
  let fetcher = state.fetchers.get(key);
2442
2448
  if (fetchControllers.has(key) && !(fetcher && fetcher.state === "loading" && fetchReloadIds.has(key))) {
@@ -2459,10 +2465,10 @@ function createRouter(init) {
2459
2465
  }
2460
2466
  updateState({ fetchers: new Map(state.fetchers) });
2461
2467
  }
2462
- function abortFetcher(key) {
2468
+ function abortFetcher(key, reason) {
2463
2469
  let controller = fetchControllers.get(key);
2464
2470
  if (controller) {
2465
- controller.abort();
2471
+ controller.abort(reason);
2466
2472
  fetchControllers.delete(key);
2467
2473
  }
2468
2474
  }
@@ -2726,6 +2732,7 @@ function createRouter(init) {
2726
2732
  createHref: (to) => init.history.createHref(to),
2727
2733
  encodeLocation: (to) => init.history.encodeLocation(to),
2728
2734
  getFetcher,
2735
+ resetFetcher,
2729
2736
  deleteFetcher: queueFetcherForDeletion,
2730
2737
  dispose,
2731
2738
  getBlocker,
@@ -2748,7 +2755,7 @@ function createStaticHandler(routes, opts) {
2748
2755
  );
2749
2756
  let manifest = {};
2750
2757
  let basename = (opts ? opts.basename : null) || "/";
2751
- let mapRouteProperties = _optionalChain([opts, 'optionalAccess', _15 => _15.mapRouteProperties]) || defaultMapRouteProperties;
2758
+ let mapRouteProperties = _optionalChain([opts, 'optionalAccess', _16 => _16.mapRouteProperties]) || defaultMapRouteProperties;
2752
2759
  let dataRoutes = convertRoutesToDataRoutes(
2753
2760
  routes,
2754
2761
  mapRouteProperties,
@@ -2881,9 +2888,9 @@ function createStaticHandler(routes, opts) {
2881
2888
  } else {
2882
2889
  let boundaryRouteId = skipLoaderErrorBubbling ? routeId : findNearestBoundary(
2883
2890
  matches,
2884
- _optionalChain([matches, 'access', _16 => _16.find, 'call', _17 => _17(
2891
+ _optionalChain([matches, 'access', _17 => _17.find, 'call', _18 => _18(
2885
2892
  (m) => m.route.id === routeId || m.route.loader
2886
- ), 'optionalAccess', _18 => _18.route, 'access', _19 => _19.id]) || routeId
2893
+ ), 'optionalAccess', _19 => _19.route, 'access', _20 => _20.id]) || routeId
2887
2894
  ).route.id;
2888
2895
  let staticContext = {
2889
2896
  matches,
@@ -3215,11 +3222,11 @@ function createStaticHandler(routes, opts) {
3215
3222
  }
3216
3223
  async function loadRouteData(request, matches, requestContext, dataStrategy, skipLoaderErrorBubbling, routeMatch, filterMatchesToLoad, pendingActionResult) {
3217
3224
  let isRouteRequest = routeMatch != null;
3218
- if (isRouteRequest && !_optionalChain([routeMatch, 'optionalAccess', _20 => _20.route, 'access', _21 => _21.loader]) && !_optionalChain([routeMatch, 'optionalAccess', _22 => _22.route, 'access', _23 => _23.lazy])) {
3225
+ if (isRouteRequest && !_optionalChain([routeMatch, 'optionalAccess', _21 => _21.route, 'access', _22 => _22.loader]) && !_optionalChain([routeMatch, 'optionalAccess', _23 => _23.route, 'access', _24 => _24.lazy])) {
3219
3226
  throw getInternalRouterError(400, {
3220
3227
  method: request.method,
3221
3228
  pathname: new URL(request.url).pathname,
3222
- routeId: _optionalChain([routeMatch, 'optionalAccess', _24 => _24.route, 'access', _25 => _25.id])
3229
+ routeId: _optionalChain([routeMatch, 'optionalAccess', _25 => _25.route, 'access', _26 => _26.id])
3223
3230
  });
3224
3231
  }
3225
3232
  let dsMatches;
@@ -3527,7 +3534,7 @@ function getMatchesToLoad(request, scopedContext, mapRouteProperties, manifest,
3527
3534
  let shouldSkipRevalidation = actionStatus && actionStatus >= 400;
3528
3535
  let baseShouldRevalidateArgs = {
3529
3536
  currentUrl,
3530
- currentParams: _optionalChain([state, 'access', _26 => _26.matches, 'access', _27 => _27[0], 'optionalAccess', _28 => _28.params]) || {},
3537
+ currentParams: _optionalChain([state, 'access', _27 => _27.matches, 'access', _28 => _28[0], 'optionalAccess', _29 => _29.params]) || {},
3531
3538
  nextUrl,
3532
3539
  nextParams: matches[0].params,
3533
3540
  ...submission,
@@ -3541,7 +3548,7 @@ function getMatchesToLoad(request, scopedContext, mapRouteProperties, manifest,
3541
3548
  forceShouldLoad = false;
3542
3549
  } else if (route.lazy) {
3543
3550
  forceShouldLoad = true;
3544
- } else if (route.loader == null) {
3551
+ } else if (!routeHasLoaderOrMiddleware(route)) {
3545
3552
  forceShouldLoad = false;
3546
3553
  } else if (initialHydration) {
3547
3554
  forceShouldLoad = shouldLoadRouteOnHydration(
@@ -3673,11 +3680,14 @@ function getMatchesToLoad(request, scopedContext, mapRouteProperties, manifest,
3673
3680
  });
3674
3681
  return { dsMatches, revalidatingFetchers };
3675
3682
  }
3683
+ function routeHasLoaderOrMiddleware(route) {
3684
+ return route.loader != null || route.middleware != null && route.middleware.length > 0;
3685
+ }
3676
3686
  function shouldLoadRouteOnHydration(route, loaderData, errors) {
3677
3687
  if (route.lazy) {
3678
3688
  return true;
3679
3689
  }
3680
- if (!route.loader) {
3690
+ if (!routeHasLoaderOrMiddleware(route)) {
3681
3691
  return false;
3682
3692
  }
3683
3693
  let hasData = loaderData != null && route.id in loaderData;
@@ -3748,7 +3758,7 @@ function patchRoutesImpl(routeId, children, routesToUse, manifest, mapRoutePrope
3748
3758
  let newRoutes = convertRoutesToDataRoutes(
3749
3759
  uniqueChildren,
3750
3760
  mapRouteProperties,
3751
- [routeId || "_", "patch", String(_optionalChain([childrenToPatch, 'optionalAccess', _29 => _29.length]) || "0")],
3761
+ [routeId || "_", "patch", String(_optionalChain([childrenToPatch, 'optionalAccess', _30 => _30.length]) || "0")],
3752
3762
  manifest
3753
3763
  );
3754
3764
  childrenToPatch.push(...newRoutes);
@@ -3785,7 +3795,7 @@ function isSameRoute(newRoute, existingRoute) {
3785
3795
  return true;
3786
3796
  }
3787
3797
  return newRoute.children.every(
3788
- (aChild, i) => _optionalChain([existingRoute, 'access', _30 => _30.children, 'optionalAccess', _31 => _31.some, 'call', _32 => _32((bChild) => isSameRoute(aChild, bChild))])
3798
+ (aChild, i) => _optionalChain([existingRoute, 'access', _31 => _31.children, 'optionalAccess', _32 => _32.some, 'call', _33 => _33((bChild) => isSameRoute(aChild, bChild))])
3789
3799
  );
3790
3800
  }
3791
3801
  var lazyRoutePropertyCache = /* @__PURE__ */ new WeakMap();
@@ -3933,9 +3943,9 @@ function loadLazyRoute(route, type, manifest, mapRouteProperties, lazyRoutePrope
3933
3943
  }
3934
3944
  let lazyRoutePromise = lazyPropertyPromises.length > 0 ? Promise.all(lazyPropertyPromises).then(() => {
3935
3945
  }) : void 0;
3936
- _optionalChain([lazyRoutePromise, 'optionalAccess', _33 => _33.catch, 'call', _34 => _34(() => {
3946
+ _optionalChain([lazyRoutePromise, 'optionalAccess', _34 => _34.catch, 'call', _35 => _35(() => {
3937
3947
  })]);
3938
- _optionalChain([lazyHandlerPromise, 'optionalAccess', _35 => _35.catch, 'call', _36 => _36(() => {
3948
+ _optionalChain([lazyHandlerPromise, 'optionalAccess', _36 => _36.catch, 'call', _37 => _37(() => {
3939
3949
  })]);
3940
3950
  return {
3941
3951
  lazyRoutePromise,
@@ -4006,9 +4016,15 @@ function runClientMiddlewarePipeline(args, handler) {
4006
4016
  let { matches } = args;
4007
4017
  let maxBoundaryIdx = Math.min(
4008
4018
  // Throwing route
4009
- matches.findIndex((m) => m.route.id === routeId) || 0,
4019
+ Math.max(
4020
+ matches.findIndex((m) => m.route.id === routeId),
4021
+ 0
4022
+ ),
4010
4023
  // or the shallowest route that needs to load data
4011
- matches.findIndex((m) => m.unstable_shouldCallHandler()) || 0
4024
+ Math.max(
4025
+ matches.findIndex((m) => m.unstable_shouldCallHandler()),
4026
+ 0
4027
+ )
4012
4028
  );
4013
4029
  let boundaryRouteId = findNearestBoundary(
4014
4030
  matches,
@@ -4136,8 +4152,8 @@ function getDataStrategyMatch(mapRouteProperties, manifest, request, match, lazy
4136
4152
  return callLoaderOrAction({
4137
4153
  request,
4138
4154
  match,
4139
- lazyHandlerPromise: _optionalChain([_lazyPromises, 'optionalAccess', _37 => _37.handler]),
4140
- lazyRoutePromise: _optionalChain([_lazyPromises, 'optionalAccess', _38 => _38.route]),
4155
+ lazyHandlerPromise: _optionalChain([_lazyPromises, 'optionalAccess', _38 => _38.handler]),
4156
+ lazyRoutePromise: _optionalChain([_lazyPromises, 'optionalAccess', _39 => _39.route]),
4141
4157
  handlerOverride,
4142
4158
  scopedContext
4143
4159
  });
@@ -4177,8 +4193,8 @@ function getTargetedDataStrategyMatches(mapRouteProperties, manifest, request, m
4177
4193
  });
4178
4194
  }
4179
4195
  async function callDataStrategyImpl(dataStrategyImpl, request, matches, fetcherKey, scopedContext, isStaticHandler) {
4180
- if (matches.some((m) => _optionalChain([m, 'access', _39 => _39._lazyPromises, 'optionalAccess', _40 => _40.middleware]))) {
4181
- await Promise.all(matches.map((m) => _optionalChain([m, 'access', _41 => _41._lazyPromises, 'optionalAccess', _42 => _42.middleware])));
4196
+ if (matches.some((m) => _optionalChain([m, 'access', _40 => _40._lazyPromises, 'optionalAccess', _41 => _41.middleware]))) {
4197
+ await Promise.all(matches.map((m) => _optionalChain([m, 'access', _42 => _42._lazyPromises, 'optionalAccess', _43 => _43.middleware])));
4182
4198
  }
4183
4199
  let dataStrategyArgs = {
4184
4200
  request,
@@ -4212,8 +4228,8 @@ async function callDataStrategyImpl(dataStrategyImpl, request, matches, fetcherK
4212
4228
  try {
4213
4229
  await Promise.all(
4214
4230
  matches.flatMap((m) => [
4215
- _optionalChain([m, 'access', _43 => _43._lazyPromises, 'optionalAccess', _44 => _44.handler]),
4216
- _optionalChain([m, 'access', _45 => _45._lazyPromises, 'optionalAccess', _46 => _46.route])
4231
+ _optionalChain([m, 'access', _44 => _44._lazyPromises, 'optionalAccess', _45 => _45.handler]),
4232
+ _optionalChain([m, 'access', _46 => _46._lazyPromises, 'optionalAccess', _47 => _47.route])
4217
4233
  ])
4218
4234
  );
4219
4235
  } catch (e) {
@@ -4356,19 +4372,19 @@ async function convertDataStrategyResultToDataResult(dataStrategyResult) {
4356
4372
  return {
4357
4373
  type: "error" /* error */,
4358
4374
  error: result.data,
4359
- statusCode: _optionalChain([result, 'access', _47 => _47.init, 'optionalAccess', _48 => _48.status]),
4360
- headers: _optionalChain([result, 'access', _49 => _49.init, 'optionalAccess', _50 => _50.headers]) ? new Headers(result.init.headers) : void 0
4375
+ statusCode: _optionalChain([result, 'access', _48 => _48.init, 'optionalAccess', _49 => _49.status]),
4376
+ headers: _optionalChain([result, 'access', _50 => _50.init, 'optionalAccess', _51 => _51.headers]) ? new Headers(result.init.headers) : void 0
4361
4377
  };
4362
4378
  }
4363
4379
  return {
4364
4380
  type: "error" /* error */,
4365
4381
  error: new ErrorResponseImpl(
4366
- _optionalChain([result, 'access', _51 => _51.init, 'optionalAccess', _52 => _52.status]) || 500,
4382
+ _optionalChain([result, 'access', _52 => _52.init, 'optionalAccess', _53 => _53.status]) || 500,
4367
4383
  void 0,
4368
4384
  result.data
4369
4385
  ),
4370
4386
  statusCode: isRouteErrorResponse(result) ? result.status : void 0,
4371
- headers: _optionalChain([result, 'access', _53 => _53.init, 'optionalAccess', _54 => _54.headers]) ? new Headers(result.init.headers) : void 0
4387
+ headers: _optionalChain([result, 'access', _54 => _54.init, 'optionalAccess', _55 => _55.headers]) ? new Headers(result.init.headers) : void 0
4372
4388
  };
4373
4389
  }
4374
4390
  return {
@@ -4381,8 +4397,8 @@ async function convertDataStrategyResultToDataResult(dataStrategyResult) {
4381
4397
  return {
4382
4398
  type: "data" /* data */,
4383
4399
  data: result.data,
4384
- statusCode: _optionalChain([result, 'access', _55 => _55.init, 'optionalAccess', _56 => _56.status]),
4385
- headers: _optionalChain([result, 'access', _57 => _57.init, 'optionalAccess', _58 => _58.headers]) ? new Headers(result.init.headers) : void 0
4400
+ statusCode: _optionalChain([result, 'access', _56 => _56.init, 'optionalAccess', _57 => _57.status]),
4401
+ headers: _optionalChain([result, 'access', _58 => _58.init, 'optionalAccess', _59 => _59.headers]) ? new Headers(result.init.headers) : void 0
4386
4402
  };
4387
4403
  }
4388
4404
  return { type: "data" /* data */, data: result };
@@ -4531,7 +4547,7 @@ function processLoaderData(state, matches, results, pendingActionResult, revalid
4531
4547
  let result = fetcherResults[key];
4532
4548
  invariant(result, "Did not find corresponding fetcher result");
4533
4549
  if (isErrorResult(result)) {
4534
- let boundaryMatch = findNearestBoundary(state.matches, _optionalChain([match, 'optionalAccess', _59 => _59.route, 'access', _60 => _60.id]));
4550
+ let boundaryMatch = findNearestBoundary(state.matches, _optionalChain([match, 'optionalAccess', _60 => _60.route, 'access', _61 => _61.id]));
4535
4551
  if (!(errors && errors[boundaryMatch.route.id])) {
4536
4552
  errors = {
4537
4553
  ...errors,
@@ -4665,8 +4681,8 @@ function dataWithResponseInitToResponse(data2) {
4665
4681
  }
4666
4682
  function dataWithResponseInitToErrorResponse(data2) {
4667
4683
  return new ErrorResponseImpl(
4668
- _nullishCoalesce(_optionalChain([data2, 'access', _61 => _61.init, 'optionalAccess', _62 => _62.status]), () => ( 500)),
4669
- _nullishCoalesce(_optionalChain([data2, 'access', _63 => _63.init, 'optionalAccess', _64 => _64.statusText]), () => ( "Internal Server Error")),
4684
+ _nullishCoalesce(_optionalChain([data2, 'access', _62 => _62.init, 'optionalAccess', _63 => _63.status]), () => ( 500)),
4685
+ _nullishCoalesce(_optionalChain([data2, 'access', _64 => _64.init, 'optionalAccess', _65 => _65.statusText]), () => ( "Internal Server Error")),
4670
4686
  data2.data
4671
4687
  );
4672
4688
  }
@@ -5698,7 +5714,7 @@ function getTurboStreamSingleFetchDataStrategy(getRouter, manifest, routeModules
5698
5714
  return {
5699
5715
  hasLoader: manifestRoute.hasLoader,
5700
5716
  hasClientLoader: manifestRoute.hasClientLoader,
5701
- hasShouldRevalidate: Boolean(_optionalChain([routeModule, 'optionalAccess', _65 => _65.shouldRevalidate]))
5717
+ hasShouldRevalidate: Boolean(_optionalChain([routeModule, 'optionalAccess', _66 => _66.shouldRevalidate]))
5702
5718
  };
5703
5719
  },
5704
5720
  fetchAndDecodeViaTurboStream,
@@ -5865,7 +5881,7 @@ async function bubbleMiddlewareErrors(singleFetchPromise, matches, routesParams,
5865
5881
  let routeResult = fetchedData.routes[match.route.id];
5866
5882
  if ("error" in routeResult) {
5867
5883
  middlewareError = routeResult.error;
5868
- if (_optionalChain([results, 'access', _66 => _66[match.route.id], 'optionalAccess', _67 => _67.result]) == null) {
5884
+ if (_optionalChain([results, 'access', _67 => _67[match.route.id], 'optionalAccess', _68 => _68.result]) == null) {
5869
5885
  results[match.route.id] = {
5870
5886
  type: "error",
5871
5887
  result: middlewareError
@@ -5978,7 +5994,7 @@ async function fetchAndDecodeViaTurboStream(args, basename, targetRoutes) {
5978
5994
  }
5979
5995
  } else {
5980
5996
  let typed = decoded.value;
5981
- let routeId = _optionalChain([targetRoutes, 'optionalAccess', _68 => _68[0]]);
5997
+ let routeId = _optionalChain([targetRoutes, 'optionalAccess', _69 => _69[0]]);
5982
5998
  invariant2(routeId, "No routeId found for single fetch call decoding");
5983
5999
  if ("redirect" in typed) {
5984
6000
  data2 = { redirect: typed };
@@ -6234,10 +6250,10 @@ function useOutletContext() {
6234
6250
  }
6235
6251
  function useOutlet(context) {
6236
6252
  let outlet = React3.useContext(RouteContext).outlet;
6237
- if (outlet) {
6238
- return /* @__PURE__ */ React3.createElement(OutletContext.Provider, { value: context }, outlet);
6239
- }
6240
- return outlet;
6253
+ return React3.useMemo(
6254
+ () => outlet && /* @__PURE__ */ React3.createElement(OutletContext.Provider, { value: context }, outlet),
6255
+ [outlet, context]
6256
+ );
6241
6257
  }
6242
6258
  function useParams() {
6243
6259
  let { matches } = React3.useContext(RouteContext);
@@ -6290,7 +6306,7 @@ Please change the parent <Route path="${parentPath}"> to <Route path="${parentPa
6290
6306
  if (locationArg) {
6291
6307
  let parsedLocationArg = typeof locationArg === "string" ? parsePath(locationArg) : locationArg;
6292
6308
  invariant(
6293
- parentPathnameBase === "/" || _optionalChain([parsedLocationArg, 'access', _69 => _69.pathname, 'optionalAccess', _70 => _70.startsWith, 'call', _71 => _71(parentPathnameBase)]),
6309
+ parentPathnameBase === "/" || _optionalChain([parsedLocationArg, 'access', _70 => _70.pathname, 'optionalAccess', _71 => _71.startsWith, 'call', _72 => _72(parentPathnameBase)]),
6294
6310
  `When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${parentPathnameBase}" but pathname "${parsedLocationArg.pathname}" was given in the \`location\` prop.`
6295
6311
  );
6296
6312
  location = parsedLocationArg;
@@ -6321,13 +6337,23 @@ Please change the parent <Route path="${parentPath}"> to <Route path="${parentPa
6321
6337
  params: Object.assign({}, parentParams, match.params),
6322
6338
  pathname: joinPaths([
6323
6339
  parentPathnameBase,
6324
- // Re-encode pathnames that were decoded inside matchRoutes
6325
- navigator.encodeLocation ? navigator.encodeLocation(match.pathname).pathname : match.pathname
6340
+ // Re-encode pathnames that were decoded inside matchRoutes.
6341
+ // Pre-encode `?` and `#` ahead of `encodeLocation` because it uses
6342
+ // `new URL()` internally and we need to prevent it from treating
6343
+ // them as separators
6344
+ navigator.encodeLocation ? navigator.encodeLocation(
6345
+ match.pathname.replace(/\?/g, "%3F").replace(/#/g, "%23")
6346
+ ).pathname : match.pathname
6326
6347
  ]),
6327
6348
  pathnameBase: match.pathnameBase === "/" ? parentPathnameBase : joinPaths([
6328
6349
  parentPathnameBase,
6329
6350
  // Re-encode pathnames that were decoded inside matchRoutes
6330
- navigator.encodeLocation ? navigator.encodeLocation(match.pathnameBase).pathname : match.pathnameBase
6351
+ // Pre-encode `?` and `#` ahead of `encodeLocation` because it uses
6352
+ // `new URL()` internally and we need to prevent it from treating
6353
+ // them as separators
6354
+ navigator.encodeLocation ? navigator.encodeLocation(
6355
+ match.pathnameBase.replace(/\?/g, "%3F").replace(/#/g, "%23")
6356
+ ).pathname : match.pathnameBase
6331
6357
  ])
6332
6358
  })
6333
6359
  ),
@@ -6442,10 +6468,10 @@ function _renderMatches(matches, parentMatches = [], dataRouterState = null, uns
6442
6468
  }
6443
6469
  }
6444
6470
  let renderedMatches = matches;
6445
- let errors = _optionalChain([dataRouterState, 'optionalAccess', _72 => _72.errors]);
6471
+ let errors = _optionalChain([dataRouterState, 'optionalAccess', _73 => _73.errors]);
6446
6472
  if (errors != null) {
6447
6473
  let errorIndex = renderedMatches.findIndex(
6448
- (m) => m.route.id && _optionalChain([errors, 'optionalAccess', _73 => _73[m.route.id]]) !== void 0
6474
+ (m) => m.route.id && _optionalChain([errors, 'optionalAccess', _74 => _74[m.route.id]]) !== void 0
6449
6475
  );
6450
6476
  invariant(
6451
6477
  errorIndex >= 0,
@@ -6623,15 +6649,15 @@ function useRouteError() {
6623
6649
  if (error !== void 0) {
6624
6650
  return error;
6625
6651
  }
6626
- return _optionalChain([state, 'access', _74 => _74.errors, 'optionalAccess', _75 => _75[routeId]]);
6652
+ return _optionalChain([state, 'access', _75 => _75.errors, 'optionalAccess', _76 => _76[routeId]]);
6627
6653
  }
6628
6654
  function useAsyncValue() {
6629
6655
  let value = React3.useContext(AwaitContext);
6630
- return _optionalChain([value, 'optionalAccess', _76 => _76._data]);
6656
+ return _optionalChain([value, 'optionalAccess', _77 => _77._data]);
6631
6657
  }
6632
6658
  function useAsyncError() {
6633
6659
  let value = React3.useContext(AwaitContext);
6634
- return _optionalChain([value, 'optionalAccess', _77 => _77._error]);
6660
+ return _optionalChain([value, 'optionalAccess', _78 => _78._error]);
6635
6661
  }
6636
6662
  var blockerId = 0;
6637
6663
  function useBlocker(shouldBlock) {
@@ -6743,7 +6769,7 @@ function getKeyedLinksForMatches(matches, routeModules, manifest) {
6743
6769
  let route = manifest.routes[match.route.id];
6744
6770
  return [
6745
6771
  route && route.css ? route.css.map((href) => ({ rel: "stylesheet", href })) : [],
6746
- _optionalChain([module, 'optionalAccess', _78 => _78.links, 'optionalCall', _79 => _79()]) || []
6772
+ _optionalChain([module, 'optionalAccess', _79 => _79.links, 'optionalCall', _80 => _80()]) || []
6747
6773
  ];
6748
6774
  }).flat(2);
6749
6775
  let preloads = getModuleLinkHrefs(matches, manifest);
@@ -6844,7 +6870,7 @@ function getNewMatchesForLinks(page, nextMatches, currentMatches, manifest, loca
6844
6870
  // param change, /users/123 -> /users/456
6845
6871
  currentMatches[index].pathname !== match.pathname || // splat param changed, which is not present in match.path
6846
6872
  // e.g. /files/images/avatar.jpg -> files/finances.xls
6847
- _optionalChain([currentMatches, 'access', _80 => _80[index], 'access', _81 => _81.route, 'access', _82 => _82.path, 'optionalAccess', _83 => _83.endsWith, 'call', _84 => _84("*")]) && currentMatches[index].params["*"] !== match.params["*"]
6873
+ _optionalChain([currentMatches, 'access', _81 => _81[index], 'access', _82 => _82.route, 'access', _83 => _83.path, 'optionalAccess', _84 => _84.endsWith, 'call', _85 => _85("*")]) && currentMatches[index].params["*"] !== match.params["*"]
6848
6874
  );
6849
6875
  };
6850
6876
  if (mode === "assets") {
@@ -6867,7 +6893,7 @@ function getNewMatchesForLinks(page, nextMatches, currentMatches, manifest, loca
6867
6893
  location.pathname + location.search + location.hash,
6868
6894
  window.origin
6869
6895
  ),
6870
- currentParams: _optionalChain([currentMatches, 'access', _85 => _85[0], 'optionalAccess', _86 => _86.params]) || {},
6896
+ currentParams: _optionalChain([currentMatches, 'access', _86 => _86[0], 'optionalAccess', _87 => _87.params]) || {},
6871
6897
  nextUrl: new URL(page, window.origin),
6872
6898
  nextParams: match.params,
6873
6899
  defaultShouldRevalidate: true
@@ -7139,10 +7165,10 @@ function createClientRoutes(manifest, routeModulesCache, initialState, ssr, isSp
7139
7165
  )
7140
7166
  });
7141
7167
  let hasInitialData = initialState && initialState.loaderData && route.id in initialState.loaderData;
7142
- let initialData = hasInitialData ? _optionalChain([initialState, 'optionalAccess', _87 => _87.loaderData, 'optionalAccess', _88 => _88[route.id]]) : void 0;
7168
+ let initialData = hasInitialData ? _optionalChain([initialState, 'optionalAccess', _88 => _88.loaderData, 'optionalAccess', _89 => _89[route.id]]) : void 0;
7143
7169
  let hasInitialError = initialState && initialState.errors && route.id in initialState.errors;
7144
- let initialError = hasInitialError ? _optionalChain([initialState, 'optionalAccess', _89 => _89.errors, 'optionalAccess', _90 => _90[route.id]]) : void 0;
7145
- let isHydrationRequest = needsRevalidation == null && (_optionalChain([routeModule, 'access', _91 => _91.clientLoader, 'optionalAccess', _92 => _92.hydrate]) === true || !route.hasLoader);
7170
+ let initialError = hasInitialError ? _optionalChain([initialState, 'optionalAccess', _90 => _90.errors, 'optionalAccess', _91 => _91[route.id]]) : void 0;
7171
+ let isHydrationRequest = needsRevalidation == null && (_optionalChain([routeModule, 'access', _92 => _92.clientLoader, 'optionalAccess', _93 => _93.hydrate]) === true || !route.hasLoader);
7146
7172
  dataRoute.loader = async ({ request, params, context }, singleFetch) => {
7147
7173
  try {
7148
7174
  let result = await prefetchStylesAndCallHandler(async () => {
@@ -7436,7 +7462,7 @@ function getPatchRoutesOnNavigationFunction(manifest, routeModules, ssr, routeDi
7436
7462
  function useFogOFWarDiscovery(router, manifest, routeModules, ssr, routeDiscovery, isSpaMode) {
7437
7463
  React6.useEffect(() => {
7438
7464
  if (!isFogOfWarEnabled(routeDiscovery, ssr) || // @ts-expect-error - TS doesn't know about this yet
7439
- _optionalChain([window, 'access', _93 => _93.navigator, 'optionalAccess', _94 => _94.connection, 'optionalAccess', _95 => _95.saveData]) === true) {
7465
+ _optionalChain([window, 'access', _94 => _94.navigator, 'optionalAccess', _95 => _95.connection, 'optionalAccess', _96 => _96.saveData]) === true) {
7440
7466
  return;
7441
7467
  }
7442
7468
  function registerElement(el) {
@@ -7499,7 +7525,7 @@ function getManifestPath(_manifestPath, basename) {
7499
7525
  var MANIFEST_VERSION_STORAGE_KEY = "react-router-manifest-version";
7500
7526
  async function fetchAndApplyManifestPatches(paths, errorReloadPath, manifest, routeModules, ssr, isSpaMode, basename, manifestPath, patchRoutes, signal) {
7501
7527
  const searchParams = new URLSearchParams();
7502
- paths.sort().forEach((path) => searchParams.append("p", path));
7528
+ searchParams.set("paths", paths.sort().join(","));
7503
7529
  searchParams.set("version", manifest.version);
7504
7530
  let url = new URL(
7505
7531
  getManifestPath(manifestPath, basename),
@@ -7522,13 +7548,16 @@ async function fetchAndApplyManifestPatches(paths, errorReloadPath, manifest, ro
7522
7548
  );
7523
7549
  return;
7524
7550
  }
7525
- if (sessionStorage.getItem(MANIFEST_VERSION_STORAGE_KEY) === manifest.version) {
7526
- console.error(
7527
- "Unable to discover routes due to manifest version mismatch."
7528
- );
7529
- return;
7551
+ try {
7552
+ if (sessionStorage.getItem(MANIFEST_VERSION_STORAGE_KEY) === manifest.version) {
7553
+ console.error(
7554
+ "Unable to discover routes due to manifest version mismatch."
7555
+ );
7556
+ return;
7557
+ }
7558
+ sessionStorage.setItem(MANIFEST_VERSION_STORAGE_KEY, manifest.version);
7559
+ } catch (e2) {
7530
7560
  }
7531
- sessionStorage.setItem(MANIFEST_VERSION_STORAGE_KEY, manifest.version);
7532
7561
  window.location.href = errorReloadPath;
7533
7562
  console.warn("Detected manifest version mismatch, reloading...");
7534
7563
  await new Promise(() => {
@@ -7536,10 +7565,13 @@ async function fetchAndApplyManifestPatches(paths, errorReloadPath, manifest, ro
7536
7565
  } else if (res.status >= 400) {
7537
7566
  throw new Error(await res.text());
7538
7567
  }
7539
- sessionStorage.removeItem(MANIFEST_VERSION_STORAGE_KEY);
7568
+ try {
7569
+ sessionStorage.removeItem(MANIFEST_VERSION_STORAGE_KEY);
7570
+ } catch (e3) {
7571
+ }
7540
7572
  serverPatches = await res.json();
7541
7573
  } catch (e) {
7542
- if (_optionalChain([signal, 'optionalAccess', _96 => _96.aborted])) return;
7574
+ if (_optionalChain([signal, 'optionalAccess', _97 => _97.aborted])) return;
7543
7575
  throw e;
7544
7576
  }
7545
7577
  let knownRoutes = new Set(Object.keys(manifest.routes));
@@ -7780,7 +7812,7 @@ function PrefetchPageLinksImpl({
7780
7812
  if (!manifestRoute || !manifestRoute.hasLoader) {
7781
7813
  return;
7782
7814
  }
7783
- if (!newMatchesForData.some((m2) => m2.route.id === m.route.id) && m.route.id in loaderData && _optionalChain([routeModules, 'access', _97 => _97[m.route.id], 'optionalAccess', _98 => _98.shouldRevalidate])) {
7815
+ if (!newMatchesForData.some((m2) => m2.route.id === m.route.id) && m.route.id in loaderData && _optionalChain([routeModules, 'access', _98 => _98[m.route.id], 'optionalAccess', _99 => _99.shouldRevalidate])) {
7784
7816
  foundOptOutRoute = true;
7785
7817
  } else if (manifestRoute.hasClientLoader) {
7786
7818
  foundOptOutRoute = true;
@@ -7854,7 +7886,7 @@ function Meta() {
7854
7886
  error
7855
7887
  };
7856
7888
  matches[i] = match;
7857
- if (_optionalChain([routeModule, 'optionalAccess', _99 => _99.meta])) {
7889
+ if (_optionalChain([routeModule, 'optionalAccess', _100 => _100.meta])) {
7858
7890
  routeMeta = typeof routeModule.meta === "function" ? routeModule.meta({
7859
7891
  data: data2,
7860
7892
  loaderData: data2,
@@ -7953,7 +7985,7 @@ function Scripts(scriptProps) {
7953
7985
  }
7954
7986
  let streamScript = "window.__reactRouterContext.stream = new ReadableStream({start(controller){window.__reactRouterContext.streamController = controller;}}).pipeThrough(new TextEncoderStream());";
7955
7987
  let contextScript = staticContext ? `window.__reactRouterContext = ${serverHandoffString};${streamScript}` : " ";
7956
- let routeModulesScript = !isStatic ? " " : `${_optionalChain([manifest, 'access', _100 => _100.hmr, 'optionalAccess', _101 => _101.runtime]) ? `import ${JSON.stringify(manifest.hmr.runtime)};` : ""}${!enableFogOfWar ? `import ${JSON.stringify(manifest.url)}` : ""};
7988
+ let routeModulesScript = !isStatic ? " " : `${_optionalChain([manifest, 'access', _101 => _101.hmr, 'optionalAccess', _102 => _102.runtime]) ? `import ${JSON.stringify(manifest.hmr.runtime)};` : ""}${!enableFogOfWar ? `import ${JSON.stringify(manifest.url)}` : ""};
7957
7989
  ${matches.map((match, routeIndex) => {
7958
7990
  let routeVarName = `route${routeIndex}`;
7959
7991
  let manifestEntry = manifest.routes[match.route.id];
@@ -8183,7 +8215,7 @@ function BoundaryShell({
8183
8215
  children
8184
8216
  }) {
8185
8217
  let { routeModules } = useFrameworkContext();
8186
- if (_optionalChain([routeModules, 'access', _102 => _102.root, 'optionalAccess', _103 => _103.Layout]) && !isOutsideRemixApp) {
8218
+ if (_optionalChain([routeModules, 'access', _103 => _103.root, 'optionalAccess', _104 => _104.Layout]) && !isOutsideRemixApp) {
8187
8219
  return children;
8188
8220
  }
8189
8221
  return /* @__PURE__ */ React8.createElement("html", { lang: "en" }, /* @__PURE__ */ React8.createElement("head", null, /* @__PURE__ */ React8.createElement("meta", { charSet: "utf-8" }), /* @__PURE__ */ React8.createElement(