react-router 7.3.0-pre.0 → 7.3.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.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * react-router v7.3.0-pre.0
2
+ * react-router v7.3.0
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -2835,8 +2835,6 @@ function createStaticHandler(routes, opts) {
2835
2835
  "When using middleware in `staticHandler.query()`, any provided `requestContext` must bean instance of `unstable_RouterContextProvider`"
2836
2836
  );
2837
2837
  try {
2838
- let tailIdx = [...matches].reverse().findIndex((m) => !filterMatchesToLoad || filterMatchesToLoad(m));
2839
- let lowestLoadingIdx = tailIdx < 0 ? 0 : matches.length - 1 - tailIdx;
2840
2838
  let renderedStaticContext;
2841
2839
  let response = await runMiddlewarePipeline(
2842
2840
  {
@@ -2847,7 +2845,6 @@ function createStaticHandler(routes, opts) {
2847
2845
  // this to the proper type knowing it's not an `AppLoadContext`
2848
2846
  context: requestContext
2849
2847
  },
2850
- lowestLoadingIdx,
2851
2848
  true,
2852
2849
  async () => {
2853
2850
  let result2 = await queryImpl(
@@ -2967,7 +2964,6 @@ function createStaticHandler(routes, opts) {
2967
2964
  // this to the proper type knowing it's not an `AppLoadContext`
2968
2965
  context: requestContext
2969
2966
  },
2970
- matches.length - 1,
2971
2967
  true,
2972
2968
  async () => {
2973
2969
  let result2 = await queryImpl(
@@ -3724,55 +3720,39 @@ async function defaultDataStrategyWithMiddleware(args) {
3724
3720
  if (!args.matches.some((m) => m.route.unstable_middleware)) {
3725
3721
  return defaultDataStrategy(args);
3726
3722
  }
3727
- let lastIndex = args.matches.length - 1;
3728
- for (let i = lastIndex; i >= 0; i--) {
3729
- if (args.matches[i].shouldLoad) {
3730
- lastIndex = i;
3731
- break;
3732
- }
3733
- }
3734
- let results = await runMiddlewarePipeline(
3723
+ return runMiddlewarePipeline(
3735
3724
  args,
3736
- lastIndex,
3737
3725
  false,
3738
- async (keyedResults) => {
3739
- Object.assign(keyedResults, await defaultDataStrategy(args));
3740
- },
3741
- (e, keyedResults) => {
3742
- Object.assign(keyedResults, {
3743
- [e.routeId]: { type: "error", result: e.error }
3744
- });
3745
- }
3726
+ () => defaultDataStrategy(args),
3727
+ (e) => ({ [e.routeId]: { type: "error", result: e.error } })
3746
3728
  );
3747
- return results;
3748
3729
  }
3749
- async function runMiddlewarePipeline({
3750
- request,
3751
- params,
3752
- context,
3753
- matches
3754
- }, lastIndex, propagateResult, handler, errorHandler) {
3730
+ async function runMiddlewarePipeline(args, propagateResult, handler, errorHandler) {
3731
+ let { matches, request, params, context } = args;
3755
3732
  let middlewareState = {
3756
- keyedResults: {},
3733
+ handlerResult: void 0,
3757
3734
  propagateResult
3758
3735
  };
3759
3736
  try {
3737
+ let tuples = matches.flatMap(
3738
+ (m) => m.route.unstable_middleware ? m.route.unstable_middleware.map((fn) => [m.route.id, fn]) : []
3739
+ );
3760
3740
  let result = await callRouteMiddleware(
3761
- matches.slice(0, lastIndex + 1).flatMap(
3762
- (m) => m.route.unstable_middleware ? m.route.unstable_middleware.map((fn) => [m.route.id, fn]) : []
3763
- ),
3764
- 0,
3765
3741
  { request, params, context },
3742
+ tuples,
3766
3743
  middlewareState,
3767
3744
  handler
3768
3745
  );
3769
- return middlewareState.propagateResult ? result : middlewareState.keyedResults;
3746
+ return middlewareState.propagateResult ? result : middlewareState.handlerResult;
3770
3747
  } catch (e) {
3771
3748
  if (!(e instanceof MiddlewareError)) {
3772
3749
  throw e;
3773
3750
  }
3774
- let result = await errorHandler(e, middlewareState.keyedResults);
3775
- return middlewareState.propagateResult ? result : middlewareState.keyedResults;
3751
+ let result = await errorHandler(e);
3752
+ if (propagateResult || !middlewareState.handlerResult) {
3753
+ return result;
3754
+ }
3755
+ return Object.assign(middlewareState.handlerResult, result);
3776
3756
  }
3777
3757
  }
3778
3758
  var MiddlewareError = class {
@@ -3781,7 +3761,7 @@ var MiddlewareError = class {
3781
3761
  this.error = error;
3782
3762
  }
3783
3763
  };
3784
- async function callRouteMiddleware(middlewares, idx, args, middlewareState, handler) {
3764
+ async function callRouteMiddleware(args, middlewares, middlewareState, handler, idx = 0) {
3785
3765
  let { request } = args;
3786
3766
  if (request.signal.aborted) {
3787
3767
  if (request.signal.reason) {
@@ -3793,8 +3773,8 @@ async function callRouteMiddleware(middlewares, idx, args, middlewareState, hand
3793
3773
  }
3794
3774
  let tuple = middlewares[idx];
3795
3775
  if (!tuple) {
3796
- let result = await handler(middlewareState.keyedResults);
3797
- return result;
3776
+ middlewareState.handlerResult = await handler();
3777
+ return middlewareState.handlerResult;
3798
3778
  }
3799
3779
  let [routeId, middleware] = tuple;
3800
3780
  let nextCalled = false;
@@ -3805,11 +3785,11 @@ async function callRouteMiddleware(middlewares, idx, args, middlewareState, hand
3805
3785
  }
3806
3786
  nextCalled = true;
3807
3787
  let result = await callRouteMiddleware(
3808
- middlewares,
3809
- idx + 1,
3810
3788
  args,
3789
+ middlewares,
3811
3790
  middlewareState,
3812
- handler
3791
+ handler,
3792
+ idx + 1
3813
3793
  );
3814
3794
  if (middlewareState.propagateResult) {
3815
3795
  nextResult = result;
@@ -6172,28 +6152,15 @@ function StreamTransfer({
6172
6152
  )));
6173
6153
  }
6174
6154
  }
6175
- function middlewareErrorHandler(e, keyedResults) {
6176
- Object.assign(keyedResults, {
6177
- [e.routeId]: { type: "error", result: e.error }
6178
- });
6179
- }
6180
6155
  function getSingleFetchDataStrategy(manifest, routeModules, ssr, basename, getRouter) {
6181
6156
  return async (args) => {
6182
6157
  let { request, matches, fetcherKey } = args;
6183
6158
  if (request.method !== "GET") {
6184
6159
  return runMiddlewarePipeline(
6185
6160
  args,
6186
- matches.findIndex((m) => m.shouldLoad),
6187
6161
  false,
6188
- async (keyedResults) => {
6189
- let results = await singleFetchActionStrategy(
6190
- request,
6191
- matches,
6192
- basename
6193
- );
6194
- Object.assign(keyedResults, results);
6195
- },
6196
- middlewareErrorHandler
6162
+ () => singleFetchActionStrategy(request, matches, basename),
6163
+ (e) => ({ [e.routeId]: { type: "error", result: e.error } })
6197
6164
  );
6198
6165
  }
6199
6166
  if (!ssr) {
@@ -6201,64 +6168,35 @@ function getSingleFetchDataStrategy(manifest, routeModules, ssr, basename, getRo
6201
6168
  (m) => m.shouldLoad && manifest.routes[m.route.id]?.hasLoader && !manifest.routes[m.route.id]?.hasClientLoader
6202
6169
  );
6203
6170
  if (!foundRevalidatingServerLoader) {
6204
- let tailIdx = [...matches].reverse().findIndex((m) => m.shouldLoad);
6205
- let lowestLoadingIndex2 = tailIdx < 0 ? 0 : matches.length - 1 - tailIdx;
6206
6171
  return runMiddlewarePipeline(
6207
6172
  args,
6208
- lowestLoadingIndex2,
6209
6173
  false,
6210
- async (keyedResults) => {
6211
- let results = await nonSsrStrategy(
6212
- manifest,
6213
- request,
6214
- matches,
6215
- basename
6216
- );
6217
- Object.assign(keyedResults, results);
6218
- },
6219
- middlewareErrorHandler
6174
+ () => nonSsrStrategy(manifest, request, matches, basename),
6175
+ (e) => ({ [e.routeId]: { type: "error", result: e.error } })
6220
6176
  );
6221
6177
  }
6222
6178
  }
6223
6179
  if (fetcherKey) {
6224
6180
  return runMiddlewarePipeline(
6225
6181
  args,
6226
- matches.findIndex((m) => m.shouldLoad),
6227
6182
  false,
6228
- async (keyedResults) => {
6229
- let results = await singleFetchLoaderFetcherStrategy(
6230
- request,
6231
- matches,
6232
- basename
6233
- );
6234
- Object.assign(keyedResults, results);
6235
- },
6236
- middlewareErrorHandler
6183
+ () => singleFetchLoaderFetcherStrategy(request, matches, basename),
6184
+ (e) => ({ [e.routeId]: { type: "error", result: e.error } })
6237
6185
  );
6238
6186
  }
6239
- let lowestLoadingIndex = getLowestLoadingIndex(
6240
- manifest,
6241
- routeModules,
6242
- getRouter(),
6243
- matches
6244
- );
6245
6187
  return runMiddlewarePipeline(
6246
6188
  args,
6247
- lowestLoadingIndex,
6248
6189
  false,
6249
- async (keyedResults) => {
6250
- let results = await singleFetchLoaderNavigationStrategy(
6251
- manifest,
6252
- routeModules,
6253
- ssr,
6254
- getRouter(),
6255
- request,
6256
- matches,
6257
- basename
6258
- );
6259
- Object.assign(keyedResults, results);
6260
- },
6261
- middlewareErrorHandler
6190
+ () => singleFetchLoaderNavigationStrategy(
6191
+ manifest,
6192
+ routeModules,
6193
+ ssr,
6194
+ getRouter(),
6195
+ request,
6196
+ matches,
6197
+ basename
6198
+ ),
6199
+ (e) => ({ [e.routeId]: { type: "error", result: e.error } })
6262
6200
  );
6263
6201
  };
6264
6202
  }
@@ -6311,17 +6249,6 @@ async function nonSsrStrategy(manifest, request, matches, basename) {
6311
6249
  function isOptedOut(manifestRoute, routeModule, match, router) {
6312
6250
  return match.route.id in router.state.loaderData && manifestRoute && manifestRoute.hasLoader && routeModule && routeModule.shouldRevalidate;
6313
6251
  }
6314
- function getLowestLoadingIndex(manifest, routeModules, router, matches) {
6315
- let tailIdx = [...matches].reverse().findIndex(
6316
- (m) => m.shouldLoad || !isOptedOut(
6317
- manifest.routes[m.route.id],
6318
- routeModules[m.route.id],
6319
- m,
6320
- router
6321
- )
6322
- );
6323
- return tailIdx < 0 ? 0 : matches.length - 1 - tailIdx;
6324
- }
6325
6252
  async function singleFetchLoaderNavigationStrategy(manifest, routeModules, ssr, router, request, matches, basename) {
6326
6253
  let routesParams = /* @__PURE__ */ new Set();
6327
6254
  let foundOptOutRoute = false;
@@ -7736,7 +7663,7 @@ function mergeRefs(...refs) {
7736
7663
  var isBrowser = typeof window !== "undefined" && typeof window.document !== "undefined" && typeof window.document.createElement !== "undefined";
7737
7664
  try {
7738
7665
  if (isBrowser) {
7739
- window.__reactRouterVersion = "7.3.0-pre.0";
7666
+ window.__reactRouterVersion = "7.3.0";
7740
7667
  }
7741
7668
  } catch (e) {
7742
7669
  }
@@ -1,5 +1,5 @@
1
1
  /**
2
- * react-router v7.3.0-pre.0
2
+ * react-router v7.3.0
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -123,7 +123,7 @@ import {
123
123
  useSearchParams,
124
124
  useSubmit,
125
125
  useViewTransitionState
126
- } from "./chunk-W5LWFPOT.mjs";
126
+ } from "./chunk-K6CSEXPM.mjs";
127
127
  export {
128
128
  Await,
129
129
  BrowserRouter,
@@ -99,10 +99,11 @@ type ClientDataFunctionArgs<T extends RouteInfo> = {
99
99
  params: T["params"];
100
100
  /**
101
101
  * When `future.unstable_middleware` is not enabled, this is undefined.
102
+ *
102
103
  * When `future.unstable_middleware` is enabled, this is an instance of
103
- * `{@link unstable_RouterContextProvider}` and can be used to access context values
104
+ * `unstable_RouterContextProvider` and can be used to access context values
104
105
  * from your route middlewares. You may pass in initial context values in your
105
- * `{@link unstable_getContext}` function passed tp `{@link HydratedRouter}`
106
+ * `<HydratedRouter unstable_getContext>` prop
106
107
  */
107
108
  context: unstable_RouterContextProvider;
108
109
  };
@@ -126,15 +127,15 @@ type ServerDataFunctionArgs<T extends RouteInfo> = {
126
127
  params: T["params"];
127
128
  /**
128
129
  * Without `future.unstable_middleware` enabled, this is the context passed in
129
- * to your server adapter's `{@link getLoadContext}` function. It's a way to bridge the
130
+ * to your server adapter's `getLoadContext` function. It's a way to bridge the
130
131
  * gap between the adapter's request/response API with your React Router app.
131
132
  * It is only applicable if you are using a custom server adapter.
132
133
  *
133
134
  * With `future.unstable_middleware` enabled, this is an instance of
134
- * `{@link unstable_RouterContextProvider}` and can be used for type-safe access to
135
+ * `unstable_RouterContextProvider` and can be used for type-safe access to
135
136
  * context value set in your route middlewares. If you are using a custom
136
137
  * server adapter, you may provide an initial set of context values from your
137
- * `{@link getLoadContext}` function.
138
+ * `getLoadContext` function.
138
139
  */
139
140
  context: MiddlewareEnabled extends true ? unstable_RouterContextProvider : AppLoadContext;
140
141
  };
@@ -99,10 +99,11 @@ type ClientDataFunctionArgs<T extends RouteInfo> = {
99
99
  params: T["params"];
100
100
  /**
101
101
  * When `future.unstable_middleware` is not enabled, this is undefined.
102
+ *
102
103
  * When `future.unstable_middleware` is enabled, this is an instance of
103
- * `{@link unstable_RouterContextProvider}` and can be used to access context values
104
+ * `unstable_RouterContextProvider` and can be used to access context values
104
105
  * from your route middlewares. You may pass in initial context values in your
105
- * `{@link unstable_getContext}` function passed tp `{@link HydratedRouter}`
106
+ * `<HydratedRouter unstable_getContext>` prop
106
107
  */
107
108
  context: unstable_RouterContextProvider;
108
109
  };
@@ -126,15 +127,15 @@ type ServerDataFunctionArgs<T extends RouteInfo> = {
126
127
  params: T["params"];
127
128
  /**
128
129
  * Without `future.unstable_middleware` enabled, this is the context passed in
129
- * to your server adapter's `{@link getLoadContext}` function. It's a way to bridge the
130
+ * to your server adapter's `getLoadContext` function. It's a way to bridge the
130
131
  * gap between the adapter's request/response API with your React Router app.
131
132
  * It is only applicable if you are using a custom server adapter.
132
133
  *
133
134
  * With `future.unstable_middleware` enabled, this is an instance of
134
- * `{@link unstable_RouterContextProvider}` and can be used for type-safe access to
135
+ * `unstable_RouterContextProvider` and can be used for type-safe access to
135
136
  * context value set in your route middlewares. If you are using a custom
136
137
  * server adapter, you may provide an initial set of context values from your
137
- * `{@link getLoadContext}` function.
138
+ * `getLoadContext` function.
138
139
  */
139
140
  context: MiddlewareEnabled extends true ? unstable_RouterContextProvider : AppLoadContext;
140
141
  };
@@ -1,5 +1,5 @@
1
1
  /**
2
- * react-router v7.3.0-pre.0
2
+ * react-router v7.3.0
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -1,5 +1,5 @@
1
1
  /**
2
- * react-router v7.3.0-pre.0
2
+ * react-router v7.3.0
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -1,5 +1,5 @@
1
1
  /**
2
- * react-router v7.3.0-pre.0
2
+ * react-router v7.3.0
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -2687,8 +2687,6 @@ function createStaticHandler(routes, opts) {
2687
2687
  "When using middleware in `staticHandler.query()`, any provided `requestContext` must bean instance of `unstable_RouterContextProvider`"
2688
2688
  );
2689
2689
  try {
2690
- let tailIdx = [...matches].reverse().findIndex((m) => !filterMatchesToLoad || filterMatchesToLoad(m));
2691
- let lowestLoadingIdx = tailIdx < 0 ? 0 : matches.length - 1 - tailIdx;
2692
2690
  let renderedStaticContext;
2693
2691
  let response = await runMiddlewarePipeline(
2694
2692
  {
@@ -2699,7 +2697,6 @@ function createStaticHandler(routes, opts) {
2699
2697
  // this to the proper type knowing it's not an `AppLoadContext`
2700
2698
  context: requestContext
2701
2699
  },
2702
- lowestLoadingIdx,
2703
2700
  true,
2704
2701
  async () => {
2705
2702
  let result2 = await queryImpl(
@@ -2819,7 +2816,6 @@ function createStaticHandler(routes, opts) {
2819
2816
  // this to the proper type knowing it's not an `AppLoadContext`
2820
2817
  context: requestContext
2821
2818
  },
2822
- matches.length - 1,
2823
2819
  true,
2824
2820
  async () => {
2825
2821
  let result2 = await queryImpl(
@@ -3576,55 +3572,39 @@ async function defaultDataStrategyWithMiddleware(args) {
3576
3572
  if (!args.matches.some((m) => m.route.unstable_middleware)) {
3577
3573
  return defaultDataStrategy(args);
3578
3574
  }
3579
- let lastIndex = args.matches.length - 1;
3580
- for (let i = lastIndex; i >= 0; i--) {
3581
- if (args.matches[i].shouldLoad) {
3582
- lastIndex = i;
3583
- break;
3584
- }
3585
- }
3586
- let results = await runMiddlewarePipeline(
3575
+ return runMiddlewarePipeline(
3587
3576
  args,
3588
- lastIndex,
3589
3577
  false,
3590
- async (keyedResults) => {
3591
- Object.assign(keyedResults, await defaultDataStrategy(args));
3592
- },
3593
- (e, keyedResults) => {
3594
- Object.assign(keyedResults, {
3595
- [e.routeId]: { type: "error", result: e.error }
3596
- });
3597
- }
3578
+ () => defaultDataStrategy(args),
3579
+ (e) => ({ [e.routeId]: { type: "error", result: e.error } })
3598
3580
  );
3599
- return results;
3600
3581
  }
3601
- async function runMiddlewarePipeline({
3602
- request,
3603
- params,
3604
- context,
3605
- matches
3606
- }, lastIndex, propagateResult, handler, errorHandler) {
3582
+ async function runMiddlewarePipeline(args, propagateResult, handler, errorHandler) {
3583
+ let { matches, request, params, context } = args;
3607
3584
  let middlewareState = {
3608
- keyedResults: {},
3585
+ handlerResult: void 0,
3609
3586
  propagateResult
3610
3587
  };
3611
3588
  try {
3589
+ let tuples = matches.flatMap(
3590
+ (m) => m.route.unstable_middleware ? m.route.unstable_middleware.map((fn) => [m.route.id, fn]) : []
3591
+ );
3612
3592
  let result = await callRouteMiddleware(
3613
- matches.slice(0, lastIndex + 1).flatMap(
3614
- (m) => m.route.unstable_middleware ? m.route.unstable_middleware.map((fn) => [m.route.id, fn]) : []
3615
- ),
3616
- 0,
3617
3593
  { request, params, context },
3594
+ tuples,
3618
3595
  middlewareState,
3619
3596
  handler
3620
3597
  );
3621
- return middlewareState.propagateResult ? result : middlewareState.keyedResults;
3598
+ return middlewareState.propagateResult ? result : middlewareState.handlerResult;
3622
3599
  } catch (e) {
3623
3600
  if (!(e instanceof MiddlewareError)) {
3624
3601
  throw e;
3625
3602
  }
3626
- let result = await errorHandler(e, middlewareState.keyedResults);
3627
- return middlewareState.propagateResult ? result : middlewareState.keyedResults;
3603
+ let result = await errorHandler(e);
3604
+ if (propagateResult || !middlewareState.handlerResult) {
3605
+ return result;
3606
+ }
3607
+ return Object.assign(middlewareState.handlerResult, result);
3628
3608
  }
3629
3609
  }
3630
3610
  var MiddlewareError = class {
@@ -3633,7 +3613,7 @@ var MiddlewareError = class {
3633
3613
  this.error = error;
3634
3614
  }
3635
3615
  };
3636
- async function callRouteMiddleware(middlewares, idx, args, middlewareState, handler) {
3616
+ async function callRouteMiddleware(args, middlewares, middlewareState, handler, idx = 0) {
3637
3617
  let { request } = args;
3638
3618
  if (request.signal.aborted) {
3639
3619
  if (request.signal.reason) {
@@ -3645,8 +3625,8 @@ async function callRouteMiddleware(middlewares, idx, args, middlewareState, hand
3645
3625
  }
3646
3626
  let tuple = middlewares[idx];
3647
3627
  if (!tuple) {
3648
- let result = await handler(middlewareState.keyedResults);
3649
- return result;
3628
+ middlewareState.handlerResult = await handler();
3629
+ return middlewareState.handlerResult;
3650
3630
  }
3651
3631
  let [routeId, middleware] = tuple;
3652
3632
  let nextCalled = false;
@@ -3657,11 +3637,11 @@ async function callRouteMiddleware(middlewares, idx, args, middlewareState, hand
3657
3637
  }
3658
3638
  nextCalled = true;
3659
3639
  let result = await callRouteMiddleware(
3660
- middlewares,
3661
- idx + 1,
3662
3640
  args,
3641
+ middlewares,
3663
3642
  middlewareState,
3664
- handler
3643
+ handler,
3644
+ idx + 1
3665
3645
  );
3666
3646
  if (middlewareState.propagateResult) {
3667
3647
  nextResult = result;
@@ -6024,28 +6004,15 @@ function StreamTransfer({
6024
6004
  )));
6025
6005
  }
6026
6006
  }
6027
- function middlewareErrorHandler(e, keyedResults) {
6028
- Object.assign(keyedResults, {
6029
- [e.routeId]: { type: "error", result: e.error }
6030
- });
6031
- }
6032
6007
  function getSingleFetchDataStrategy(manifest, routeModules, ssr, basename, getRouter) {
6033
6008
  return async (args) => {
6034
6009
  let { request, matches, fetcherKey } = args;
6035
6010
  if (request.method !== "GET") {
6036
6011
  return runMiddlewarePipeline(
6037
6012
  args,
6038
- matches.findIndex((m) => m.shouldLoad),
6039
6013
  false,
6040
- async (keyedResults) => {
6041
- let results = await singleFetchActionStrategy(
6042
- request,
6043
- matches,
6044
- basename
6045
- );
6046
- Object.assign(keyedResults, results);
6047
- },
6048
- middlewareErrorHandler
6014
+ () => singleFetchActionStrategy(request, matches, basename),
6015
+ (e) => ({ [e.routeId]: { type: "error", result: e.error } })
6049
6016
  );
6050
6017
  }
6051
6018
  if (!ssr) {
@@ -6053,64 +6020,35 @@ function getSingleFetchDataStrategy(manifest, routeModules, ssr, basename, getRo
6053
6020
  (m) => m.shouldLoad && manifest.routes[m.route.id]?.hasLoader && !manifest.routes[m.route.id]?.hasClientLoader
6054
6021
  );
6055
6022
  if (!foundRevalidatingServerLoader) {
6056
- let tailIdx = [...matches].reverse().findIndex((m) => m.shouldLoad);
6057
- let lowestLoadingIndex2 = tailIdx < 0 ? 0 : matches.length - 1 - tailIdx;
6058
6023
  return runMiddlewarePipeline(
6059
6024
  args,
6060
- lowestLoadingIndex2,
6061
6025
  false,
6062
- async (keyedResults) => {
6063
- let results = await nonSsrStrategy(
6064
- manifest,
6065
- request,
6066
- matches,
6067
- basename
6068
- );
6069
- Object.assign(keyedResults, results);
6070
- },
6071
- middlewareErrorHandler
6026
+ () => nonSsrStrategy(manifest, request, matches, basename),
6027
+ (e) => ({ [e.routeId]: { type: "error", result: e.error } })
6072
6028
  );
6073
6029
  }
6074
6030
  }
6075
6031
  if (fetcherKey) {
6076
6032
  return runMiddlewarePipeline(
6077
6033
  args,
6078
- matches.findIndex((m) => m.shouldLoad),
6079
6034
  false,
6080
- async (keyedResults) => {
6081
- let results = await singleFetchLoaderFetcherStrategy(
6082
- request,
6083
- matches,
6084
- basename
6085
- );
6086
- Object.assign(keyedResults, results);
6087
- },
6088
- middlewareErrorHandler
6035
+ () => singleFetchLoaderFetcherStrategy(request, matches, basename),
6036
+ (e) => ({ [e.routeId]: { type: "error", result: e.error } })
6089
6037
  );
6090
6038
  }
6091
- let lowestLoadingIndex = getLowestLoadingIndex(
6092
- manifest,
6093
- routeModules,
6094
- getRouter(),
6095
- matches
6096
- );
6097
6039
  return runMiddlewarePipeline(
6098
6040
  args,
6099
- lowestLoadingIndex,
6100
6041
  false,
6101
- async (keyedResults) => {
6102
- let results = await singleFetchLoaderNavigationStrategy(
6103
- manifest,
6104
- routeModules,
6105
- ssr,
6106
- getRouter(),
6107
- request,
6108
- matches,
6109
- basename
6110
- );
6111
- Object.assign(keyedResults, results);
6112
- },
6113
- middlewareErrorHandler
6042
+ () => singleFetchLoaderNavigationStrategy(
6043
+ manifest,
6044
+ routeModules,
6045
+ ssr,
6046
+ getRouter(),
6047
+ request,
6048
+ matches,
6049
+ basename
6050
+ ),
6051
+ (e) => ({ [e.routeId]: { type: "error", result: e.error } })
6114
6052
  );
6115
6053
  };
6116
6054
  }
@@ -6163,17 +6101,6 @@ async function nonSsrStrategy(manifest, request, matches, basename) {
6163
6101
  function isOptedOut(manifestRoute, routeModule, match, router) {
6164
6102
  return match.route.id in router.state.loaderData && manifestRoute && manifestRoute.hasLoader && routeModule && routeModule.shouldRevalidate;
6165
6103
  }
6166
- function getLowestLoadingIndex(manifest, routeModules, router, matches) {
6167
- let tailIdx = [...matches].reverse().findIndex(
6168
- (m) => m.shouldLoad || !isOptedOut(
6169
- manifest.routes[m.route.id],
6170
- routeModules[m.route.id],
6171
- m,
6172
- router
6173
- )
6174
- );
6175
- return tailIdx < 0 ? 0 : matches.length - 1 - tailIdx;
6176
- }
6177
6104
  async function singleFetchLoaderNavigationStrategy(manifest, routeModules, ssr, router, request, matches, basename) {
6178
6105
  let routesParams = /* @__PURE__ */ new Set();
6179
6106
  let foundOptOutRoute = false;
@@ -7588,7 +7515,7 @@ function mergeRefs(...refs) {
7588
7515
  var isBrowser = typeof window !== "undefined" && typeof window.document !== "undefined" && typeof window.document.createElement !== "undefined";
7589
7516
  try {
7590
7517
  if (isBrowser) {
7591
- window.__reactRouterVersion = "7.3.0-pre.0";
7518
+ window.__reactRouterVersion = "7.3.0";
7592
7519
  }
7593
7520
  } catch (e) {
7594
7521
  }