react-router 0.0.0-experimental-c8b52c995 → 0.0.0-experimental-668b4f5c4

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 (35) hide show
  1. package/dist/development/{chunk-4K5PIBZY.mjs → chunk-FBGXXFNB.mjs} +447 -191
  2. package/dist/development/dom-export.d.mts +2 -2
  3. package/dist/development/dom-export.d.ts +2 -2
  4. package/dist/development/dom-export.js +366 -183
  5. package/dist/development/dom-export.mjs +4 -3
  6. package/dist/{production/fog-of-war-1hWhK5ey.d.mts → development/fog-of-war-C6kTaVBt.d.ts} +3 -2
  7. package/dist/development/{fog-of-war-oa9CGk10.d.ts → fog-of-war-C_4rt_R3.d.mts} +3 -2
  8. package/dist/development/index.d.mts +6 -6
  9. package/dist/development/index.d.ts +6 -6
  10. package/dist/development/index.js +448 -191
  11. package/dist/development/index.mjs +4 -2
  12. package/dist/development/lib/types/route-module.d.mts +1 -1
  13. package/dist/development/lib/types/route-module.d.ts +1 -1
  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/development/{route-data-5OzAzQtT.d.ts → route-data-DI-fVE5O.d.mts} +12 -1
  17. package/dist/{production/route-data-5OzAzQtT.d.mts → development/route-data-DI-fVE5O.d.ts} +12 -1
  18. package/dist/production/{chunk-UDVCEGG6.mjs → chunk-DFVLYKPF.mjs} +447 -191
  19. package/dist/production/dom-export.d.mts +2 -2
  20. package/dist/production/dom-export.d.ts +2 -2
  21. package/dist/production/dom-export.js +366 -183
  22. package/dist/production/dom-export.mjs +4 -3
  23. package/dist/{development/fog-of-war-1hWhK5ey.d.mts → production/fog-of-war-C6kTaVBt.d.ts} +3 -2
  24. package/dist/production/{fog-of-war-oa9CGk10.d.ts → fog-of-war-C_4rt_R3.d.mts} +3 -2
  25. package/dist/production/index.d.mts +6 -6
  26. package/dist/production/index.d.ts +6 -6
  27. package/dist/production/index.js +448 -191
  28. package/dist/production/index.mjs +4 -2
  29. package/dist/production/lib/types/route-module.d.mts +1 -1
  30. package/dist/production/lib/types/route-module.d.ts +1 -1
  31. package/dist/production/lib/types/route-module.js +1 -1
  32. package/dist/production/lib/types/route-module.mjs +1 -1
  33. package/dist/production/{route-data-5OzAzQtT.d.ts → route-data-DI-fVE5O.d.mts} +12 -1
  34. package/dist/{development/route-data-5OzAzQtT.d.mts → production/route-data-DI-fVE5O.d.ts} +12 -1
  35. package/package.json +1 -1
@@ -1,5 +1,5 @@
1
1
  /**
2
- * react-router v0.0.0-experimental-c8b52c995
2
+ * react-router v0.0.0-experimental-668b4f5c4
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -949,6 +949,7 @@ function createRouter(init) {
949
949
  init.routes.length > 0,
950
950
  "You must provide a non-empty routes array to createRouter"
951
951
  );
952
+ let hydrationRouteProperties2 = init.hydrationRouteProperties || [];
952
953
  let mapRouteProperties2 = init.mapRouteProperties || defaultMapRouteProperties;
953
954
  let manifest = {};
954
955
  let dataRoutes = convertRoutesToDataRoutes(
@@ -1421,6 +1422,7 @@ function createRouter(init) {
1421
1422
  matches,
1422
1423
  scopedContext,
1423
1424
  fogOfWar.active,
1425
+ opts && opts.initialHydration === true,
1424
1426
  { replace: opts.replace, flushSync }
1425
1427
  );
1426
1428
  if (actionResult.shortCircuited) {
@@ -1481,7 +1483,7 @@ function createRouter(init) {
1481
1483
  errors
1482
1484
  });
1483
1485
  }
1484
- async function handleAction(request, location, submission, matches, scopedContext, isFogOfWar, opts = {}) {
1486
+ async function handleAction(request, location, submission, matches, scopedContext, isFogOfWar, initialHydration, opts = {}) {
1485
1487
  interruptActiveLoads();
1486
1488
  let navigation = getSubmittingNavigation(location, submission);
1487
1489
  updateState({ navigation }, { flushSync: opts.flushSync === true });
@@ -1535,11 +1537,19 @@ function createRouter(init) {
1535
1537
  })
1536
1538
  };
1537
1539
  } else {
1538
- let results = await callDataStrategy(
1539
- "action",
1540
+ let dsMatches = getTargetedDataStrategyMatches(
1541
+ mapRouteProperties2,
1542
+ manifest,
1540
1543
  request,
1541
- [actionMatch],
1542
1544
  matches,
1545
+ actionMatch,
1546
+ initialHydration ? [] : hydrationRouteProperties2,
1547
+ scopedContext
1548
+ );
1549
+ let results = await callDataStrategy(
1550
+ request,
1551
+ dsMatches,
1552
+ null,
1543
1553
  scopedContext,
1544
1554
  null
1545
1555
  );
@@ -1638,12 +1648,21 @@ function createRouter(init) {
1638
1648
  }
1639
1649
  }
1640
1650
  let routesToUse = inFlightDataRoutes || dataRoutes;
1641
- let [matchesToLoad, revalidatingFetchers] = getMatchesToLoad(
1651
+ let {
1652
+ navigationMatches: dsMatches,
1653
+ revalidatingFetchers,
1654
+ shouldRevalidateArgs
1655
+ } = getMatchesToLoad(
1656
+ request,
1657
+ scopedContext,
1658
+ mapRouteProperties2,
1659
+ manifest,
1642
1660
  init.history,
1643
1661
  state,
1644
1662
  matches,
1645
1663
  activeSubmission,
1646
1664
  location,
1665
+ initialHydration ? [] : hydrationRouteProperties2,
1647
1666
  initialHydration === true,
1648
1667
  isRevalidationRequired,
1649
1668
  cancelledFetcherLoads,
@@ -1655,7 +1674,7 @@ function createRouter(init) {
1655
1674
  pendingActionResult
1656
1675
  );
1657
1676
  pendingNavigationLoadId = ++incrementingLoadId;
1658
- if (matchesToLoad.length === 0 && revalidatingFetchers.length === 0) {
1677
+ if (!init.dataStrategy && !dsMatches.some((m) => m.shouldLoad) && revalidatingFetchers.length === 0) {
1659
1678
  let updatedFetchers2 = markFetchRedirectsDone();
1660
1679
  completeNavigation(
1661
1680
  location,
@@ -1699,9 +1718,9 @@ function createRouter(init) {
1699
1718
  );
1700
1719
  }
1701
1720
  let { loaderResults, fetcherResults } = await callLoadersAndMaybeResolveData(
1702
- matches,
1703
- matchesToLoad,
1721
+ dsMatches,
1704
1722
  revalidatingFetchers,
1723
+ shouldRevalidateArgs,
1705
1724
  request,
1706
1725
  scopedContext
1707
1726
  );
@@ -1903,11 +1922,19 @@ function createRouter(init) {
1903
1922
  }
1904
1923
  fetchControllers.set(key, abortController);
1905
1924
  let originatingLoadId = incrementingLoadId;
1906
- let actionResults = await callDataStrategy(
1907
- "action",
1925
+ let fetchMatches = getTargetedDataStrategyMatches(
1926
+ mapRouteProperties2,
1927
+ manifest,
1908
1928
  fetchRequest,
1909
- [match],
1910
1929
  requestMatches,
1930
+ match,
1931
+ hydrationRouteProperties2,
1932
+ scopedContext
1933
+ );
1934
+ let actionResults = await callDataStrategy(
1935
+ fetchRequest,
1936
+ fetchMatches,
1937
+ null,
1911
1938
  scopedContext,
1912
1939
  key
1913
1940
  );
@@ -1956,12 +1983,21 @@ function createRouter(init) {
1956
1983
  fetchReloadIds.set(key, loadId);
1957
1984
  let loadFetcher = getLoadingFetcher(submission, actionResult.data);
1958
1985
  state.fetchers.set(key, loadFetcher);
1959
- let [matchesToLoad, revalidatingFetchers] = getMatchesToLoad(
1986
+ let {
1987
+ navigationMatches: dsMatches,
1988
+ revalidatingFetchers,
1989
+ shouldRevalidateArgs
1990
+ } = getMatchesToLoad(
1991
+ revalidationRequest,
1992
+ scopedContext,
1993
+ mapRouteProperties2,
1994
+ manifest,
1960
1995
  init.history,
1961
1996
  state,
1962
1997
  matches,
1963
1998
  submission,
1964
1999
  nextLocation,
2000
+ hydrationRouteProperties2,
1965
2001
  false,
1966
2002
  isRevalidationRequired,
1967
2003
  cancelledFetcherLoads,
@@ -1992,9 +2028,9 @@ function createRouter(init) {
1992
2028
  abortPendingFetchRevalidations
1993
2029
  );
1994
2030
  let { loaderResults, fetcherResults } = await callLoadersAndMaybeResolveData(
1995
- matches,
1996
- matchesToLoad,
2031
+ dsMatches,
1997
2032
  revalidatingFetchers,
2033
+ shouldRevalidateArgs,
1998
2034
  revalidationRequest,
1999
2035
  scopedContext
2000
2036
  );
@@ -2106,11 +2142,19 @@ function createRouter(init) {
2106
2142
  }
2107
2143
  fetchControllers.set(key, abortController);
2108
2144
  let originatingLoadId = incrementingLoadId;
2109
- let results = await callDataStrategy(
2110
- "loader",
2145
+ let dsMatches = getTargetedDataStrategyMatches(
2146
+ mapRouteProperties2,
2147
+ manifest,
2111
2148
  fetchRequest,
2112
- [match],
2113
2149
  matches,
2150
+ match,
2151
+ hydrationRouteProperties2,
2152
+ scopedContext
2153
+ );
2154
+ let results = await callDataStrategy(
2155
+ fetchRequest,
2156
+ dsMatches,
2157
+ null,
2114
2158
  scopedContext,
2115
2159
  key
2116
2160
  );
@@ -2213,23 +2257,20 @@ function createRouter(init) {
2213
2257
  });
2214
2258
  }
2215
2259
  }
2216
- async function callDataStrategy(type, request, matchesToLoad, matches, scopedContext, fetcherKey) {
2260
+ async function callDataStrategy(request, matches, shouldRevalidateArgs, scopedContext, fetcherKey) {
2217
2261
  let results;
2218
2262
  let dataResults = {};
2219
2263
  try {
2220
2264
  results = await callDataStrategyImpl(
2221
2265
  dataStrategyImpl,
2222
- type,
2223
2266
  request,
2224
- matchesToLoad,
2225
2267
  matches,
2268
+ shouldRevalidateArgs,
2226
2269
  fetcherKey,
2227
- manifest,
2228
- mapRouteProperties2,
2229
2270
  scopedContext
2230
2271
  );
2231
2272
  } catch (e) {
2232
- matchesToLoad.forEach((m) => {
2273
+ matches.filter((m) => m.shouldLoad).forEach((m) => {
2233
2274
  dataResults[m.route.id] = {
2234
2275
  type: "error" /* error */,
2235
2276
  error: e
@@ -2258,23 +2299,21 @@ function createRouter(init) {
2258
2299
  }
2259
2300
  return dataResults;
2260
2301
  }
2261
- async function callLoadersAndMaybeResolveData(matches, matchesToLoad, fetchersToLoad, request, scopedContext) {
2302
+ async function callLoadersAndMaybeResolveData(matches, fetchersToLoad, shouldRevalidateArgs, request, scopedContext) {
2262
2303
  let loaderResultsPromise = callDataStrategy(
2263
- "loader",
2264
2304
  request,
2265
- matchesToLoad,
2266
2305
  matches,
2306
+ shouldRevalidateArgs,
2267
2307
  scopedContext,
2268
2308
  null
2269
2309
  );
2270
2310
  let fetcherResultsPromise = Promise.all(
2271
2311
  fetchersToLoad.map(async (f) => {
2272
- if (f.matches && f.match && f.controller) {
2312
+ if (f.matches && f.match && f.request && f.controller) {
2273
2313
  let results = await callDataStrategy(
2274
- "loader",
2275
- createClientSideRequest(init.history, f.path, f.controller.signal),
2276
- [f.match],
2314
+ f.request,
2277
2315
  f.matches,
2316
+ shouldRevalidateArgs,
2278
2317
  scopedContext,
2279
2318
  f.key
2280
2319
  );
@@ -2968,11 +3007,18 @@ function createStaticHandler(routes, opts) {
2968
3007
  error
2969
3008
  };
2970
3009
  } else {
2971
- let results = await callDataStrategy(
2972
- "action",
3010
+ let dsMatches = getTargetedDataStrategyMatches(
3011
+ mapRouteProperties2,
3012
+ manifest,
2973
3013
  request,
2974
- [actionMatch],
2975
3014
  matches,
3015
+ actionMatch,
3016
+ [],
3017
+ requestContext
3018
+ );
3019
+ let results = await callDataStrategy(
3020
+ request,
3021
+ dsMatches,
2976
3022
  isRouteRequest,
2977
3023
  requestContext,
2978
3024
  dataStrategy
@@ -3090,11 +3136,46 @@ function createStaticHandler(routes, opts) {
3090
3136
  routeId: routeMatch?.route.id
3091
3137
  });
3092
3138
  }
3093
- let requestMatches = routeMatch ? [routeMatch] : pendingActionResult && isErrorResult(pendingActionResult[1]) ? getLoaderMatchesUntilBoundary(matches, pendingActionResult[0]) : matches;
3094
- let matchesToLoad = requestMatches.filter(
3095
- (m) => (m.route.loader || m.route.lazy) && (!filterMatchesToLoad || filterMatchesToLoad(m))
3096
- );
3097
- if (matchesToLoad.length === 0) {
3139
+ let dsMatches;
3140
+ if (routeMatch) {
3141
+ dsMatches = getTargetedDataStrategyMatches(
3142
+ mapRouteProperties2,
3143
+ manifest,
3144
+ request,
3145
+ matches,
3146
+ routeMatch,
3147
+ [],
3148
+ requestContext
3149
+ );
3150
+ } else {
3151
+ let maxIdx = pendingActionResult && isErrorResult(pendingActionResult[1]) ? (
3152
+ // Up to but not including the boundary
3153
+ matches.findIndex((m) => m.route.id === pendingActionResult[0]) - 1
3154
+ ) : void 0;
3155
+ dsMatches = matches.map((match, index) => {
3156
+ if (maxIdx != null && index > maxIdx) {
3157
+ return getDataStrategyMatch(
3158
+ mapRouteProperties2,
3159
+ manifest,
3160
+ request,
3161
+ match,
3162
+ [],
3163
+ requestContext,
3164
+ false
3165
+ );
3166
+ }
3167
+ return getDataStrategyMatch(
3168
+ mapRouteProperties2,
3169
+ manifest,
3170
+ request,
3171
+ match,
3172
+ [],
3173
+ requestContext,
3174
+ (match.route.loader || match.route.lazy) != null && (!filterMatchesToLoad || filterMatchesToLoad(match))
3175
+ );
3176
+ });
3177
+ }
3178
+ if (!dataStrategy && !dsMatches.some((m) => m.shouldLoad)) {
3098
3179
  return {
3099
3180
  matches,
3100
3181
  // Add a null for all matched routes for proper revalidation on the client
@@ -3110,10 +3191,8 @@ function createStaticHandler(routes, opts) {
3110
3191
  };
3111
3192
  }
3112
3193
  let results = await callDataStrategy(
3113
- "loader",
3114
3194
  request,
3115
- matchesToLoad,
3116
- matches,
3195
+ dsMatches,
3117
3196
  isRouteRequest,
3118
3197
  requestContext,
3119
3198
  dataStrategy
@@ -3129,7 +3208,7 @@ function createStaticHandler(routes, opts) {
3129
3208
  skipLoaderErrorBubbling
3130
3209
  );
3131
3210
  let executedLoaders = new Set(
3132
- matchesToLoad.map((match) => match.route.id)
3211
+ dsMatches.filter((m) => m.shouldLoad).map((match) => match.route.id)
3133
3212
  );
3134
3213
  matches.forEach((match) => {
3135
3214
  if (!executedLoaders.has(match.route.id)) {
@@ -3141,16 +3220,13 @@ function createStaticHandler(routes, opts) {
3141
3220
  matches
3142
3221
  };
3143
3222
  }
3144
- async function callDataStrategy(type, request, matchesToLoad, matches, isRouteRequest, requestContext, dataStrategy) {
3223
+ async function callDataStrategy(request, matches, isRouteRequest, requestContext, dataStrategy) {
3145
3224
  let results = await callDataStrategyImpl(
3146
3225
  dataStrategy || defaultDataStrategy,
3147
- type,
3148
3226
  request,
3149
- matchesToLoad,
3150
3227
  matches,
3151
3228
  null,
3152
- manifest,
3153
- mapRouteProperties2,
3229
+ null,
3154
3230
  requestContext
3155
3231
  );
3156
3232
  let dataResults = {};
@@ -3357,62 +3433,110 @@ function normalizeNavigateOptions(isFetcher, path, opts) {
3357
3433
  parsedPath.search = `?${searchParams}`;
3358
3434
  return { path: createPath(parsedPath), submission };
3359
3435
  }
3360
- function getLoaderMatchesUntilBoundary(matches, boundaryId, includeBoundary = false) {
3361
- let index = matches.findIndex((m) => m.route.id === boundaryId);
3362
- if (index >= 0) {
3363
- return matches.slice(0, includeBoundary ? index + 1 : index);
3364
- }
3365
- return matches;
3366
- }
3367
- function getMatchesToLoad(history, state, matches, submission, location, initialHydration, isRevalidationRequired, cancelledFetcherLoads, fetchersQueuedForDeletion, fetchLoadMatches, fetchRedirectIds, routesToUse, basename, pendingActionResult) {
3436
+ function getMatchesToLoad(request, scopedContext, mapRouteProperties2, manifest, history, state, matches, submission, location, lazyRoutePropertiesToSkip, initialHydration, isRevalidationRequired, cancelledFetcherLoads, fetchersQueuedForDeletion, fetchLoadMatches, fetchRedirectIds, routesToUse, basename, pendingActionResult) {
3368
3437
  let actionResult = pendingActionResult ? isErrorResult(pendingActionResult[1]) ? pendingActionResult[1].error : pendingActionResult[1].data : void 0;
3369
3438
  let currentUrl = history.createURL(state.location);
3370
3439
  let nextUrl = history.createURL(location);
3371
- let boundaryMatches = matches;
3440
+ let maxIdx;
3372
3441
  if (initialHydration && state.errors) {
3373
- boundaryMatches = getLoaderMatchesUntilBoundary(
3374
- matches,
3375
- Object.keys(state.errors)[0],
3376
- true
3377
- );
3442
+ let boundaryId = Object.keys(state.errors)[0];
3443
+ maxIdx = matches.findIndex((m) => m.route.id === boundaryId);
3378
3444
  } else if (pendingActionResult && isErrorResult(pendingActionResult[1])) {
3379
- boundaryMatches = getLoaderMatchesUntilBoundary(
3380
- matches,
3381
- pendingActionResult[0]
3382
- );
3445
+ let boundaryId = pendingActionResult[0];
3446
+ maxIdx = matches.findIndex((m) => m.route.id === boundaryId) - 1;
3383
3447
  }
3384
3448
  let actionStatus = pendingActionResult ? pendingActionResult[1].statusCode : void 0;
3385
3449
  let shouldSkipRevalidation = actionStatus && actionStatus >= 400;
3386
- let navigationMatches = boundaryMatches.filter((match, index) => {
3450
+ let shouldRevalidateArgs = initialHydration ? null : {
3451
+ currentUrl,
3452
+ currentParams: state.matches[0]?.params || {},
3453
+ nextUrl,
3454
+ nextParams: matches[0].params,
3455
+ ...submission,
3456
+ actionResult,
3457
+ actionStatus
3458
+ };
3459
+ let navigationMatches = matches.map((match, index) => {
3387
3460
  let { route } = match;
3388
- if (route.lazy) {
3389
- return true;
3390
- }
3391
- if (route.loader == null) {
3392
- return false;
3393
- }
3394
- if (initialHydration) {
3395
- return shouldLoadRouteOnHydration(route, state.loaderData, state.errors);
3396
- }
3397
- if (isNewLoader(state.loaderData, state.matches[index], match)) {
3398
- return true;
3399
- }
3400
- let currentRouteMatch = state.matches[index];
3401
- let nextRouteMatch = match;
3402
- return shouldRevalidateLoader(match, {
3403
- currentUrl,
3404
- currentParams: currentRouteMatch.params,
3405
- nextUrl,
3406
- nextParams: nextRouteMatch.params,
3407
- ...submission,
3408
- actionResult,
3409
- actionStatus,
3410
- defaultShouldRevalidate: shouldSkipRevalidation ? false : (
3461
+ if (maxIdx != null && index > maxIdx) {
3462
+ return getDataStrategyMatch(
3463
+ mapRouteProperties2,
3464
+ manifest,
3465
+ request,
3466
+ match,
3467
+ lazyRoutePropertiesToSkip,
3468
+ scopedContext,
3469
+ false
3470
+ );
3471
+ } else if (route.lazy) {
3472
+ return getDataStrategyMatch(
3473
+ mapRouteProperties2,
3474
+ manifest,
3475
+ request,
3476
+ match,
3477
+ lazyRoutePropertiesToSkip,
3478
+ scopedContext,
3479
+ true
3480
+ );
3481
+ } else if (route.loader == null) {
3482
+ return getDataStrategyMatch(
3483
+ mapRouteProperties2,
3484
+ manifest,
3485
+ request,
3486
+ match,
3487
+ lazyRoutePropertiesToSkip,
3488
+ scopedContext,
3489
+ false
3490
+ );
3491
+ } else if (initialHydration) {
3492
+ return getDataStrategyMatch(
3493
+ mapRouteProperties2,
3494
+ manifest,
3495
+ request,
3496
+ match,
3497
+ lazyRoutePropertiesToSkip,
3498
+ scopedContext,
3499
+ shouldLoadRouteOnHydration(route, state.loaderData, state.errors)
3500
+ );
3501
+ } else if (isNewLoader(state.loaderData, state.matches[index], match)) {
3502
+ return getDataStrategyMatch(
3503
+ mapRouteProperties2,
3504
+ manifest,
3505
+ request,
3506
+ match,
3507
+ lazyRoutePropertiesToSkip,
3508
+ scopedContext,
3509
+ true
3510
+ );
3511
+ } else {
3512
+ let defaultShouldRevalidate = shouldSkipRevalidation ? false : (
3411
3513
  // Forced revalidation due to submission, useRevalidator, or X-Remix-Revalidate
3412
3514
  isRevalidationRequired || currentUrl.pathname + currentUrl.search === nextUrl.pathname + nextUrl.search || // Search params affect all loaders
3413
- currentUrl.search !== nextUrl.search || isNewRouteInstance(currentRouteMatch, nextRouteMatch)
3414
- )
3415
- });
3515
+ currentUrl.search !== nextUrl.search || isNewRouteInstance(state.matches[index], match)
3516
+ );
3517
+ invariant(
3518
+ shouldRevalidateArgs,
3519
+ "Expected shouldRevalidateArgs to be defined for fetcher"
3520
+ );
3521
+ let shouldLoad = shouldRevalidateLoader(match, {
3522
+ ...shouldRevalidateArgs,
3523
+ defaultShouldRevalidate
3524
+ });
3525
+ return getDataStrategyMatch(
3526
+ mapRouteProperties2,
3527
+ manifest,
3528
+ request,
3529
+ match,
3530
+ lazyRoutePropertiesToSkip,
3531
+ scopedContext,
3532
+ shouldLoad,
3533
+ (defaultOverride) => shouldRevalidateLoader(match, {
3534
+ // We're not in initialHydration here so this will be defined
3535
+ ...shouldRevalidateArgs,
3536
+ defaultShouldRevalidate: typeof defaultOverride === "boolean" ? defaultOverride : defaultShouldRevalidate
3537
+ })
3538
+ );
3539
+ }
3416
3540
  });
3417
3541
  let revalidatingFetchers = [];
3418
3542
  fetchLoadMatches.forEach((f, key) => {
@@ -3427,44 +3551,97 @@ function getMatchesToLoad(history, state, matches, submission, location, initial
3427
3551
  path: f.path,
3428
3552
  matches: null,
3429
3553
  match: null,
3554
+ request: null,
3430
3555
  controller: null
3431
3556
  });
3432
3557
  return;
3433
3558
  }
3559
+ if (fetchRedirectIds.has(key)) {
3560
+ return;
3561
+ }
3434
3562
  let fetcher = state.fetchers.get(key);
3435
3563
  let fetcherMatch = getTargetMatch(fetcherMatches, f.path);
3436
- let shouldRevalidate = false;
3437
- if (fetchRedirectIds.has(key)) {
3438
- shouldRevalidate = false;
3439
- } else if (cancelledFetcherLoads.has(key)) {
3564
+ let fetchController = new AbortController();
3565
+ let fetchRequest = createClientSideRequest(
3566
+ history,
3567
+ f.path,
3568
+ fetchController.signal
3569
+ );
3570
+ if (cancelledFetcherLoads.has(key)) {
3440
3571
  cancelledFetcherLoads.delete(key);
3441
- shouldRevalidate = true;
3442
- } else if (fetcher && fetcher.state !== "idle" && fetcher.data === void 0) {
3443
- shouldRevalidate = isRevalidationRequired;
3444
- } else {
3445
- shouldRevalidate = shouldRevalidateLoader(fetcherMatch, {
3446
- currentUrl,
3447
- currentParams: state.matches[state.matches.length - 1].params,
3448
- nextUrl,
3449
- nextParams: matches[matches.length - 1].params,
3450
- ...submission,
3451
- actionResult,
3452
- actionStatus,
3453
- defaultShouldRevalidate: shouldSkipRevalidation ? false : isRevalidationRequired
3454
- });
3455
- }
3456
- if (shouldRevalidate) {
3457
3572
  revalidatingFetchers.push({
3458
3573
  key,
3459
3574
  routeId: f.routeId,
3460
3575
  path: f.path,
3461
- matches: fetcherMatches,
3576
+ matches: getTargetedDataStrategyMatches(
3577
+ mapRouteProperties2,
3578
+ manifest,
3579
+ fetchRequest,
3580
+ fetcherMatches,
3581
+ fetcherMatch,
3582
+ lazyRoutePropertiesToSkip,
3583
+ scopedContext
3584
+ ),
3462
3585
  match: fetcherMatch,
3463
- controller: new AbortController()
3586
+ request: fetchRequest,
3587
+ controller: fetchController
3464
3588
  });
3589
+ } else if (fetcher && fetcher.state !== "idle" && fetcher.data === void 0) {
3590
+ if (isRevalidationRequired) {
3591
+ revalidatingFetchers.push({
3592
+ key,
3593
+ routeId: f.routeId,
3594
+ path: f.path,
3595
+ matches: getTargetedDataStrategyMatches(
3596
+ mapRouteProperties2,
3597
+ manifest,
3598
+ fetchRequest,
3599
+ fetcherMatches,
3600
+ fetcherMatch,
3601
+ lazyRoutePropertiesToSkip,
3602
+ scopedContext
3603
+ ),
3604
+ match: fetcherMatch,
3605
+ request: fetchRequest,
3606
+ controller: fetchController
3607
+ });
3608
+ }
3609
+ } else {
3610
+ let defaultShouldRevalidate = shouldSkipRevalidation ? false : isRevalidationRequired;
3611
+ invariant(
3612
+ shouldRevalidateArgs,
3613
+ "Expected shouldRevalidateArgs to be defined for fetcher"
3614
+ );
3615
+ let shouldLoad = shouldRevalidateLoader(fetcherMatch, {
3616
+ ...shouldRevalidateArgs,
3617
+ defaultShouldRevalidate
3618
+ });
3619
+ if (shouldLoad) {
3620
+ revalidatingFetchers.push({
3621
+ key,
3622
+ routeId: f.routeId,
3623
+ path: f.path,
3624
+ matches: getTargetedDataStrategyMatches(
3625
+ mapRouteProperties2,
3626
+ manifest,
3627
+ fetchRequest,
3628
+ fetcherMatches,
3629
+ fetcherMatch,
3630
+ lazyRoutePropertiesToSkip,
3631
+ scopedContext
3632
+ ),
3633
+ match: fetcherMatch,
3634
+ request: fetchRequest,
3635
+ controller: fetchController
3636
+ });
3637
+ }
3465
3638
  }
3466
3639
  });
3467
- return [navigationMatches, revalidatingFetchers];
3640
+ return {
3641
+ navigationMatches,
3642
+ revalidatingFetchers,
3643
+ shouldRevalidateArgs
3644
+ };
3468
3645
  }
3469
3646
  function shouldLoadRouteOnHydration(route, loaderData, errors) {
3470
3647
  if (route.lazy) {
@@ -3610,7 +3787,7 @@ var loadLazyRouteProperty = ({
3610
3787
  return propertyPromise;
3611
3788
  };
3612
3789
  var lazyRouteFunctionCache = /* @__PURE__ */ new WeakMap();
3613
- function loadLazyRoute(route, type, manifest, mapRouteProperties2) {
3790
+ function loadLazyRoute(route, type, manifest, mapRouteProperties2, lazyRoutePropertiesToSkip) {
3614
3791
  let routeToUpdate = manifest[route.id];
3615
3792
  invariant(routeToUpdate, "No route found in manifest");
3616
3793
  if (!route.lazy) {
@@ -3668,6 +3845,8 @@ function loadLazyRoute(route, type, manifest, mapRouteProperties2) {
3668
3845
  });
3669
3846
  })();
3670
3847
  lazyRouteFunctionCache.set(routeToUpdate, lazyRoutePromise2);
3848
+ lazyRoutePromise2.catch(() => {
3849
+ });
3671
3850
  return {
3672
3851
  lazyRoutePromise: lazyRoutePromise2,
3673
3852
  lazyHandlerPromise: lazyRoutePromise2
@@ -3677,6 +3856,9 @@ function loadLazyRoute(route, type, manifest, mapRouteProperties2) {
3677
3856
  let lazyPropertyPromises = [];
3678
3857
  let lazyHandlerPromise = void 0;
3679
3858
  for (let key of lazyKeys) {
3859
+ if (lazyRoutePropertiesToSkip && lazyRoutePropertiesToSkip.includes(key)) {
3860
+ continue;
3861
+ }
3680
3862
  let promise = loadLazyRouteProperty({
3681
3863
  key,
3682
3864
  route,
@@ -3690,7 +3872,11 @@ function loadLazyRoute(route, type, manifest, mapRouteProperties2) {
3690
3872
  }
3691
3873
  }
3692
3874
  }
3693
- let lazyRoutePromise = Promise.all(lazyPropertyPromises).then(() => {
3875
+ let lazyRoutePromise = lazyPropertyPromises.length > 0 ? Promise.all(lazyPropertyPromises).then(() => {
3876
+ }) : void 0;
3877
+ lazyRoutePromise?.catch(() => {
3878
+ });
3879
+ lazyHandlerPromise?.catch(() => {
3694
3880
  });
3695
3881
  return {
3696
3882
  lazyRoutePromise,
@@ -3828,59 +4014,107 @@ async function callRouteMiddleware(args, middlewares, propagateResult, middlewar
3828
4014
  throw error;
3829
4015
  }
3830
4016
  }
3831
- async function callDataStrategyImpl(dataStrategyImpl, type, request, matchesToLoad, matches, fetcherKey, manifest, mapRouteProperties2, scopedContext) {
3832
- let loadMiddlewarePromise = loadLazyMiddlewareForMatches(
3833
- matches,
4017
+ function getDataStrategyMatchLazyPromises(mapRouteProperties2, manifest, request, match, lazyRoutePropertiesToSkip) {
4018
+ let lazyMiddlewarePromise = loadLazyRouteProperty({
4019
+ key: "unstable_middleware",
4020
+ route: match.route,
4021
+ manifest,
4022
+ mapRouteProperties: mapRouteProperties2
4023
+ });
4024
+ let lazyRoutePromises = loadLazyRoute(
4025
+ match.route,
4026
+ isMutationMethod(request.method) ? "action" : "loader",
3834
4027
  manifest,
3835
- mapRouteProperties2
4028
+ mapRouteProperties2,
4029
+ lazyRoutePropertiesToSkip
3836
4030
  );
3837
- let lazyRoutePromises = matches.map(
3838
- (m) => loadLazyRoute(m.route, type, manifest, mapRouteProperties2)
4031
+ return {
4032
+ middleware: lazyMiddlewarePromise,
4033
+ route: lazyRoutePromises.lazyRoutePromise,
4034
+ handler: lazyRoutePromises.lazyHandlerPromise
4035
+ };
4036
+ }
4037
+ function getDataStrategyMatch(mapRouteProperties2, manifest, request, match, lazyRoutePropertiesToSkip, scopedContext, shouldLoad, unstable_shouldCallHandler = () => shouldLoad) {
4038
+ let isUsingNewApi = false;
4039
+ let _lazyPromises = getDataStrategyMatchLazyPromises(
4040
+ mapRouteProperties2,
4041
+ manifest,
4042
+ request,
4043
+ match,
4044
+ lazyRoutePropertiesToSkip
3839
4045
  );
3840
- if (loadMiddlewarePromise) {
3841
- await loadMiddlewarePromise;
3842
- }
3843
- let dsMatches = matches.map((match, i) => {
3844
- let { lazyRoutePromise, lazyHandlerPromise } = lazyRoutePromises[i];
3845
- let shouldLoad = matchesToLoad.some((m) => m.route.id === match.route.id);
3846
- let resolve = async (handlerOverride) => {
3847
- if (handlerOverride && request.method === "GET" && (match.route.lazy || match.route.loader)) {
3848
- shouldLoad = true;
3849
- }
3850
- return shouldLoad ? callLoaderOrAction({
3851
- type,
3852
- request,
3853
- match,
3854
- lazyHandlerPromise,
3855
- lazyRoutePromise,
3856
- handlerOverride,
3857
- scopedContext
3858
- }) : Promise.resolve({ type: "data" /* data */, result: void 0 });
3859
- };
3860
- return {
3861
- ...match,
3862
- shouldLoad,
3863
- resolve
3864
- };
4046
+ return {
4047
+ ...match,
4048
+ shouldLoad,
4049
+ unstable_shouldCallHandler(defaultShouldRevalidate) {
4050
+ isUsingNewApi = true;
4051
+ return unstable_shouldCallHandler(defaultShouldRevalidate);
4052
+ },
4053
+ _lazyPromises,
4054
+ resolve(handlerOverride) {
4055
+ if (isUsingNewApi || shouldLoad || handlerOverride && request.method === "GET" && (match.route.lazy || match.route.loader)) {
4056
+ return callLoaderOrAction({
4057
+ request,
4058
+ match,
4059
+ lazyHandlerPromise: _lazyPromises?.handler,
4060
+ lazyRoutePromise: _lazyPromises?.route,
4061
+ handlerOverride,
4062
+ scopedContext
4063
+ });
4064
+ }
4065
+ return Promise.resolve({ type: "data" /* data */, result: void 0 });
4066
+ }
4067
+ };
4068
+ }
4069
+ function getTargetedDataStrategyMatches(mapRouteProperties2, manifest, request, matches, targetMatch, lazyRoutePropertiesToSkip, scopedContext) {
4070
+ return matches.map((match) => {
4071
+ if (match.route.id !== targetMatch.route.id) {
4072
+ return {
4073
+ ...match,
4074
+ shouldLoad: false,
4075
+ unstable_shouldCallHandler: () => false,
4076
+ _lazyPromises: getDataStrategyMatchLazyPromises(
4077
+ mapRouteProperties2,
4078
+ manifest,
4079
+ request,
4080
+ match,
4081
+ lazyRoutePropertiesToSkip
4082
+ ),
4083
+ resolve: () => Promise.resolve({ type: "data", result: void 0 })
4084
+ };
4085
+ }
4086
+ return getDataStrategyMatch(
4087
+ mapRouteProperties2,
4088
+ manifest,
4089
+ request,
4090
+ match,
4091
+ lazyRoutePropertiesToSkip,
4092
+ scopedContext,
4093
+ true
4094
+ );
3865
4095
  });
4096
+ }
4097
+ async function callDataStrategyImpl(dataStrategyImpl, request, matches, shouldRevalidateArgs, fetcherKey, scopedContext) {
4098
+ if (matches.some((m) => m._lazyPromises?.middleware)) {
4099
+ await Promise.all(matches.map((m) => m._lazyPromises?.middleware));
4100
+ }
3866
4101
  let results = await dataStrategyImpl({
3867
- matches: dsMatches,
4102
+ matches,
4103
+ unstable_shouldRevalidateArgs: shouldRevalidateArgs,
3868
4104
  request,
3869
4105
  params: matches[0].params,
3870
4106
  fetcherKey,
3871
4107
  context: scopedContext
3872
4108
  });
3873
- let allLazyRoutePromises = lazyRoutePromises.flatMap(
3874
- (promiseMap) => Object.values(promiseMap).filter(isNonNullable)
3875
- );
3876
4109
  try {
3877
- await Promise.all(allLazyRoutePromises);
4110
+ await Promise.all(
4111
+ matches.flatMap((m) => [m._lazyPromises?.handler, m._lazyPromises?.route])
4112
+ );
3878
4113
  } catch (e) {
3879
4114
  }
3880
4115
  return results;
3881
4116
  }
3882
4117
  async function callLoaderOrAction({
3883
- type,
3884
4118
  request,
3885
4119
  match,
3886
4120
  lazyHandlerPromise,
@@ -3890,6 +4124,8 @@ async function callLoaderOrAction({
3890
4124
  }) {
3891
4125
  let result;
3892
4126
  let onReject;
4127
+ let isAction = isMutationMethod(request.method);
4128
+ let type = isAction ? "action" : "loader";
3893
4129
  let runHandler = (handler) => {
3894
4130
  let reject;
3895
4131
  let abortPromise = new Promise((_, r) => reject = r);
@@ -3923,7 +4159,7 @@ async function callLoaderOrAction({
3923
4159
  return Promise.race([handlerPromise, abortPromise]);
3924
4160
  };
3925
4161
  try {
3926
- let handler = match.route[type];
4162
+ let handler = isAction ? match.route.action : match.route.loader;
3927
4163
  if (lazyHandlerPromise || lazyRoutePromise) {
3928
4164
  if (handler) {
3929
4165
  let handlerError;
@@ -3944,9 +4180,9 @@ async function callLoaderOrAction({
3944
4180
  result = value;
3945
4181
  } else {
3946
4182
  await lazyHandlerPromise;
3947
- handler = match.route[type];
3948
- if (handler) {
3949
- [result] = await Promise.all([runHandler(handler), lazyRoutePromise]);
4183
+ let handler2 = isAction ? match.route.action : match.route.loader;
4184
+ if (handler2) {
4185
+ [result] = await Promise.all([runHandler(handler2), lazyRoutePromise]);
3950
4186
  } else if (type === "action") {
3951
4187
  let url = new URL(request.url);
3952
4188
  let pathname = url.pathname + url.search;
@@ -4181,7 +4417,7 @@ function processLoaderData(state, matches, results, pendingActionResult, revalid
4181
4417
  results,
4182
4418
  pendingActionResult
4183
4419
  );
4184
- revalidatingFetchers.forEach((rf) => {
4420
+ revalidatingFetchers.filter((f) => !f.matches || f.matches.some((m) => m.shouldLoad)).forEach((rf) => {
4185
4421
  let { key, match, controller } = rf;
4186
4422
  let result = fetcherResults[key];
4187
4423
  invariant(result, "Did not find corresponding fetcher result");
@@ -5219,6 +5455,10 @@ function mapRouteProperties(route) {
5219
5455
  }
5220
5456
  return updates;
5221
5457
  }
5458
+ var hydrationRouteProperties = [
5459
+ "HydrateFallback",
5460
+ "hydrateFallbackElement"
5461
+ ];
5222
5462
  function createMemoryRouter(routes, opts) {
5223
5463
  return createRouter({
5224
5464
  basename: opts?.basename,
@@ -5230,6 +5470,7 @@ function createMemoryRouter(routes, opts) {
5230
5470
  }),
5231
5471
  hydrationData: opts?.hydrationData,
5232
5472
  routes,
5473
+ hydrationRouteProperties,
5233
5474
  mapRouteProperties,
5234
5475
  dataStrategy: opts?.dataStrategy,
5235
5476
  patchRoutesOnNavigation: opts?.patchRoutesOnNavigation
@@ -6181,26 +6422,26 @@ function StreamTransfer({
6181
6422
  function handleMiddlewareError(error, routeId) {
6182
6423
  return { [routeId]: { type: "error", result: error } };
6183
6424
  }
6184
- function getSingleFetchDataStrategy(manifest, routeModules, ssr, basename, getRouter) {
6425
+ function getSingleFetchDataStrategy(manifest, ssr, basename, getRouter) {
6185
6426
  return async (args) => {
6186
6427
  let { request, matches, fetcherKey } = args;
6187
6428
  if (request.method !== "GET") {
6188
6429
  return runMiddlewarePipeline(
6189
6430
  args,
6190
6431
  false,
6191
- () => singleFetchActionStrategy(request, matches, basename),
6432
+ () => singleFetchActionStrategy(args, basename),
6192
6433
  handleMiddlewareError
6193
6434
  );
6194
6435
  }
6195
6436
  if (!ssr) {
6196
6437
  let foundRevalidatingServerLoader = matches.some(
6197
- (m) => m.shouldLoad && manifest.routes[m.route.id]?.hasLoader && !manifest.routes[m.route.id]?.hasClientLoader
6438
+ (m) => m.unstable_shouldCallHandler() && manifest.routes[m.route.id]?.hasLoader && !manifest.routes[m.route.id]?.hasClientLoader
6198
6439
  );
6199
6440
  if (!foundRevalidatingServerLoader) {
6200
6441
  return runMiddlewarePipeline(
6201
6442
  args,
6202
6443
  false,
6203
- () => nonSsrStrategy(manifest, request, matches, basename),
6444
+ () => nonSsrStrategy(args, manifest, basename),
6204
6445
  handleMiddlewareError
6205
6446
  );
6206
6447
  }
@@ -6217,20 +6458,18 @@ function getSingleFetchDataStrategy(manifest, routeModules, ssr, basename, getRo
6217
6458
  args,
6218
6459
  false,
6219
6460
  () => singleFetchLoaderNavigationStrategy(
6461
+ args,
6220
6462
  manifest,
6221
- routeModules,
6222
6463
  ssr,
6223
6464
  getRouter(),
6224
- request,
6225
- matches,
6226
6465
  basename
6227
6466
  ),
6228
6467
  handleMiddlewareError
6229
6468
  );
6230
6469
  };
6231
6470
  }
6232
- async function singleFetchActionStrategy(request, matches, basename) {
6233
- let actionMatch = matches.find((m) => m.shouldLoad);
6471
+ async function singleFetchActionStrategy({ request, matches }, basename) {
6472
+ let actionMatch = matches.find((m) => m.unstable_shouldCallHandler());
6234
6473
  invariant2(actionMatch, "No action match found");
6235
6474
  let actionStatus = void 0;
6236
6475
  let result = await actionMatch.resolve(async (handler) => {
@@ -6256,8 +6495,8 @@ async function singleFetchActionStrategy(request, matches, basename) {
6256
6495
  }
6257
6496
  };
6258
6497
  }
6259
- async function nonSsrStrategy(manifest, request, matches, basename) {
6260
- let matchesToLoad = matches.filter((m) => m.shouldLoad);
6498
+ async function nonSsrStrategy({ request, matches }, manifest, basename) {
6499
+ let matchesToLoad = matches.filter((m) => m.unstable_shouldCallHandler());
6261
6500
  let url = stripIndexParam(singleFetchUrl(request.url, basename));
6262
6501
  let init = await createRequestInit(request);
6263
6502
  let results = {};
@@ -6275,7 +6514,11 @@ async function nonSsrStrategy(manifest, request, matches, basename) {
6275
6514
  );
6276
6515
  return results;
6277
6516
  }
6278
- async function singleFetchLoaderNavigationStrategy(manifest, routeModules, ssr, router, request, matches, basename) {
6517
+ async function singleFetchLoaderNavigationStrategy({
6518
+ request,
6519
+ matches,
6520
+ unstable_shouldRevalidateArgs: shouldRevalidateArgs
6521
+ }, manifest, ssr, router, basename) {
6279
6522
  let routesParams = /* @__PURE__ */ new Set();
6280
6523
  let foundOptOutRoute = false;
6281
6524
  let routeDfds = matches.map(() => createDeferred2());
@@ -6289,16 +6532,11 @@ async function singleFetchLoaderNavigationStrategy(manifest, routeModules, ssr,
6289
6532
  async (m, i) => m.resolve(async (handler) => {
6290
6533
  routeDfds[i].resolve();
6291
6534
  let manifestRoute = manifest.routes[m.route.id];
6292
- if (!m.shouldLoad) {
6293
- if (!router.state.initialized) {
6294
- return;
6295
- }
6296
- if (m.route.id in router.state.loaderData && manifestRoute && m.route.shouldRevalidate) {
6297
- if (manifestRoute.hasLoader) {
6298
- foundOptOutRoute = true;
6299
- }
6300
- return;
6301
- }
6535
+ let defaultShouldRevalidate = !shouldRevalidateArgs || shouldRevalidateArgs.actionStatus == null || shouldRevalidateArgs.actionStatus < 400;
6536
+ let shouldCall = m.unstable_shouldCallHandler(defaultShouldRevalidate);
6537
+ if (!shouldCall) {
6538
+ foundOptOutRoute || (foundOptOutRoute = manifestRoute?.hasLoader === true && m.route.id in router.state.loaderData && m.route.shouldRevalidate != null);
6539
+ return;
6302
6540
  }
6303
6541
  if (manifestRoute && manifestRoute.hasClientLoader) {
6304
6542
  if (manifestRoute.hasLoader) {
@@ -6359,7 +6597,7 @@ async function singleFetchLoaderNavigationStrategy(manifest, routeModules, ssr,
6359
6597
  return results;
6360
6598
  }
6361
6599
  async function singleFetchLoaderFetcherStrategy(request, matches, basename) {
6362
- let fetcherMatch = matches.find((m) => m.shouldLoad);
6600
+ let fetcherMatch = matches.find((m) => m.unstable_shouldCallHandler());
6363
6601
  invariant2(fetcherMatch, "No fetcher match found");
6364
6602
  let result = await fetcherMatch.resolve(async (handler) => {
6365
6603
  let url = stripIndexParam(singleFetchUrl(request.url, basename));
@@ -7723,7 +7961,7 @@ function mergeRefs(...refs) {
7723
7961
  var isBrowser = typeof window !== "undefined" && typeof window.document !== "undefined" && typeof window.document.createElement !== "undefined";
7724
7962
  try {
7725
7963
  if (isBrowser) {
7726
- window.__reactRouterVersion = "0.0.0-experimental-c8b52c995";
7964
+ window.__reactRouterVersion = "0.0.0-experimental-668b4f5c4";
7727
7965
  }
7728
7966
  } catch (e) {
7729
7967
  }
@@ -7736,6 +7974,7 @@ function createBrowserRouter(routes, opts) {
7736
7974
  hydrationData: opts?.hydrationData || parseHydrationData(),
7737
7975
  routes,
7738
7976
  mapRouteProperties,
7977
+ hydrationRouteProperties,
7739
7978
  dataStrategy: opts?.dataStrategy,
7740
7979
  patchRoutesOnNavigation: opts?.patchRoutesOnNavigation,
7741
7980
  window: opts?.window
@@ -7750,6 +7989,7 @@ function createHashRouter(routes, opts) {
7750
7989
  hydrationData: opts?.hydrationData || parseHydrationData(),
7751
7990
  routes,
7752
7991
  mapRouteProperties,
7992
+ hydrationRouteProperties,
7753
7993
  dataStrategy: opts?.dataStrategy,
7754
7994
  patchRoutesOnNavigation: opts?.patchRoutesOnNavigation,
7755
7995
  window: opts?.window
@@ -9339,13 +9579,28 @@ function createStaticHandlerDataRoutes(manifest, future, parentId = "", routesBy
9339
9579
  });
9340
9580
  let decoded = await decodeViaTurboStream(stream, global);
9341
9581
  let data2 = decoded.value;
9342
- invariant3(
9343
- data2 && route.id in data2,
9344
- "Unable to decode prerendered data"
9345
- );
9346
- let result = data2[route.id];
9347
- invariant3("data" in result, "Unable to process prerendered data");
9348
- return result.data;
9582
+ if (data2 && SingleFetchRedirectSymbol in data2) {
9583
+ let result = data2[SingleFetchRedirectSymbol];
9584
+ let init = { status: result.status };
9585
+ if (result.reload) {
9586
+ throw redirectDocument(result.redirect, init);
9587
+ } else if (result.replace) {
9588
+ throw replace(result.redirect, init);
9589
+ } else {
9590
+ throw redirect(result.redirect, init);
9591
+ }
9592
+ } else {
9593
+ invariant3(
9594
+ data2 && route.id in data2,
9595
+ "Unable to decode prerendered data"
9596
+ );
9597
+ let result = data2[route.id];
9598
+ invariant3(
9599
+ "data" in result,
9600
+ "Unable to process prerendered data"
9601
+ );
9602
+ return result.data;
9603
+ }
9349
9604
  }
9350
9605
  let val = await callRouteHandler(route.module.loader, args);
9351
9606
  return val;
@@ -10435,6 +10690,7 @@ export {
10435
10690
  useAsyncError,
10436
10691
  useBlocker,
10437
10692
  mapRouteProperties,
10693
+ hydrationRouteProperties,
10438
10694
  createMemoryRouter,
10439
10695
  RouterProvider,
10440
10696
  MemoryRouter,