react-router 7.15.0 → 7.15.1

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 (60) hide show
  1. package/CHANGELOG.md +50 -10
  2. package/dist/development/{browser-CRsXgNrY.d.mts → browser-3AnU12UI.d.mts} +1 -1
  3. package/dist/development/{browser-wDl1FZEL.d.ts → browser-BOdXz9dK.d.ts} +1 -1
  4. package/dist/development/{chunk-5KNZJZUH.mjs → chunk-4N6VE7H7.mjs} +230 -113
  5. package/dist/{production/chunk-7YXKJMLN.js → development/chunk-4YRVXM2U.js} +7 -7
  6. package/dist/development/{chunk-Z5YQYACE.js → chunk-66UKHEGQ.js} +106 -103
  7. package/dist/development/{chunk-AM3XM4LS.js → chunk-D6LUOGOQ.js} +251 -137
  8. package/dist/development/{chunk-RMD3H4O3.mjs → chunk-RJYABSBD.mjs} +22 -21
  9. package/dist/{production/context-BQs41HrG.d.mts → development/context-ByvtofY2.d.mts} +7 -1
  10. package/dist/development/dom-export.d.mts +2 -2
  11. package/dist/development/dom-export.d.ts +2 -2
  12. package/dist/development/dom-export.js +48 -50
  13. package/dist/development/dom-export.mjs +23 -25
  14. package/dist/{production/index-react-server-client-CSv-KZBk.d.ts → development/index-react-server-client-BS5F89FR.d.ts} +10 -2
  15. package/dist/{production/index-react-server-client-Ck_yZ1qL.d.mts → development/index-react-server-client-DY04-103.d.mts} +10 -2
  16. package/dist/development/index-react-server-client.d.mts +2 -2
  17. package/dist/development/index-react-server-client.d.ts +2 -2
  18. package/dist/development/index-react-server-client.js +4 -4
  19. package/dist/development/index-react-server-client.mjs +2 -2
  20. package/dist/development/index-react-server.d.mts +6 -0
  21. package/dist/development/index-react-server.d.ts +6 -0
  22. package/dist/development/index-react-server.js +4 -4
  23. package/dist/development/index-react-server.mjs +4 -4
  24. package/dist/development/index.d.mts +91 -9
  25. package/dist/development/index.d.ts +91 -9
  26. package/dist/development/index.js +103 -100
  27. package/dist/development/index.mjs +5 -3
  28. package/dist/{production/instrumentation-DlJ2QV7d.d.ts → development/instrumentation-cRWWLfsU.d.ts} +7 -1
  29. package/dist/development/lib/types/internal.js +1 -1
  30. package/dist/development/lib/types/internal.mjs +1 -1
  31. package/dist/production/{browser-CRsXgNrY.d.mts → browser-3AnU12UI.d.mts} +1 -1
  32. package/dist/production/{browser-wDl1FZEL.d.ts → browser-BOdXz9dK.d.ts} +1 -1
  33. package/dist/production/{chunk-23ZOHYE5.mjs → chunk-6S4627ZB.mjs} +22 -21
  34. package/dist/production/{chunk-LCJTIOKZ.js → chunk-HUBUW7R3.js} +251 -137
  35. package/dist/production/{chunk-GM3PW4GX.mjs → chunk-JAKZPQZC.mjs} +230 -113
  36. package/dist/production/{chunk-YBQJ3ABE.js → chunk-PNZCCTKT.js} +106 -103
  37. package/dist/{development/chunk-2D5H3HU3.js → production/chunk-Y6IFXO7V.js} +7 -7
  38. package/dist/{development/context-BQs41HrG.d.mts → production/context-ByvtofY2.d.mts} +7 -1
  39. package/dist/production/dom-export.d.mts +2 -2
  40. package/dist/production/dom-export.d.ts +2 -2
  41. package/dist/production/dom-export.js +48 -50
  42. package/dist/production/dom-export.mjs +23 -25
  43. package/dist/{development/index-react-server-client-CSv-KZBk.d.ts → production/index-react-server-client-BS5F89FR.d.ts} +10 -2
  44. package/dist/{development/index-react-server-client-Ck_yZ1qL.d.mts → production/index-react-server-client-DY04-103.d.mts} +10 -2
  45. package/dist/production/index-react-server-client.d.mts +2 -2
  46. package/dist/production/index-react-server-client.d.ts +2 -2
  47. package/dist/production/index-react-server-client.js +4 -4
  48. package/dist/production/index-react-server-client.mjs +2 -2
  49. package/dist/production/index-react-server.d.mts +6 -0
  50. package/dist/production/index-react-server.d.ts +6 -0
  51. package/dist/production/index-react-server.js +4 -4
  52. package/dist/production/index-react-server.mjs +4 -4
  53. package/dist/production/index.d.mts +91 -9
  54. package/dist/production/index.d.ts +91 -9
  55. package/dist/production/index.js +103 -100
  56. package/dist/production/index.mjs +5 -3
  57. package/dist/{development/instrumentation-DlJ2QV7d.d.ts → production/instrumentation-cRWWLfsU.d.ts} +7 -1
  58. package/dist/production/lib/types/internal.js +1 -1
  59. package/dist/production/lib/types/internal.mjs +1 -1
  60. package/package.json +1 -1
@@ -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.15.0
2
+ * react-router v7.15.1
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -1323,6 +1323,8 @@ var redirectPreserveMethodStatusCodes = /* @__PURE__ */ new Set([307, 308]);
1323
1323
  var IDLE_NAVIGATION = {
1324
1324
  state: "idle",
1325
1325
  location: void 0,
1326
+ matches: void 0,
1327
+ historyAction: void 0,
1326
1328
  formMethod: void 0,
1327
1329
  formAction: void 0,
1328
1330
  formEncType: void 0,
@@ -1441,6 +1443,7 @@ function createRouter(init) {
1441
1443
  };
1442
1444
  let unlistenHistory = null;
1443
1445
  let subscribers = /* @__PURE__ */ new Set();
1446
+ let bufferedInitialStateUpdate = null;
1444
1447
  let savedScrollPositions = null;
1445
1448
  let getScrollRestorationKey = null;
1446
1449
  let getScrollPosition = null;
@@ -1622,11 +1625,21 @@ function createRouter(init) {
1622
1625
  }
1623
1626
  subscribers.clear();
1624
1627
  pendingNavigationController && pendingNavigationController.abort();
1625
- state.fetchers.forEach((_, key) => deleteFetcher(key));
1628
+ state.fetchers.forEach((_, key) => deleteFetcher(state.fetchers, key));
1626
1629
  state.blockers.forEach((_, key) => deleteBlocker(key));
1627
1630
  }
1628
1631
  function subscribe(fn) {
1629
1632
  subscribers.add(fn);
1633
+ if (bufferedInitialStateUpdate) {
1634
+ let { newErrors } = bufferedInitialStateUpdate;
1635
+ bufferedInitialStateUpdate = null;
1636
+ fn(state, {
1637
+ deletedFetchers: [],
1638
+ newErrors,
1639
+ viewTransitionOpts: void 0,
1640
+ flushSync: false
1641
+ });
1642
+ }
1630
1643
  return () => subscribers.delete(fn);
1631
1644
  }
1632
1645
  function updateState(newState, opts = {}) {
@@ -1663,6 +1676,9 @@ function createRouter(init) {
1663
1676
  unmountedFetchers.push(key);
1664
1677
  }
1665
1678
  });
1679
+ if (subscribers.size === 0) {
1680
+ bufferedInitialStateUpdate = { newErrors: _nullishCoalesce(newState.errors, () => ( null)) };
1681
+ }
1666
1682
  [...subscribers].forEach(
1667
1683
  (subscriber) => subscriber(state, {
1668
1684
  deletedFetchers: unmountedFetchers,
@@ -1671,7 +1687,7 @@ function createRouter(init) {
1671
1687
  flushSync: opts.flushSync === true
1672
1688
  })
1673
1689
  );
1674
- unmountedFetchers.forEach((key) => deleteFetcher(key));
1690
+ unmountedFetchers.forEach((key) => deleteFetcher(state.fetchers, key));
1675
1691
  mountedFetchers.forEach((key) => state.fetchers.delete(key));
1676
1692
  }
1677
1693
  function completeNavigation(location, newState, { flushSync } = {}) {
@@ -1900,7 +1916,6 @@ function createRouter(init) {
1900
1916
  pendingPreventScrollReset = (opts && opts.preventScrollReset) === true;
1901
1917
  pendingViewTransitionEnabled = (opts && opts.enableViewTransition) === true;
1902
1918
  let routesToUse = dataRoutes.activeRoutes;
1903
- let loadingNavigation = opts && opts.overrideNavigation;
1904
1919
  let matches = _optionalChain([opts, 'optionalAccess', _22 => _22.initialHydration]) && state.matches && state.matches.length > 0 && !initialMatchesIsFOW ? (
1905
1920
  // `matchRoutes()` has already been called if we're in here via `router.initialize()`
1906
1921
  state.matches
@@ -1937,6 +1952,11 @@ function createRouter(init) {
1937
1952
  );
1938
1953
  return;
1939
1954
  }
1955
+ let loadingNavigation = opts && opts.overrideNavigation ? {
1956
+ ...opts.overrideNavigation,
1957
+ matches,
1958
+ historyAction
1959
+ } : void 0;
1940
1960
  pendingNavigationController = new AbortController();
1941
1961
  let request = createClientSideRequest(
1942
1962
  init.history,
@@ -1957,6 +1977,7 @@ function createRouter(init) {
1957
1977
  location,
1958
1978
  opts.submission,
1959
1979
  matches,
1980
+ historyAction,
1960
1981
  scopedContext,
1961
1982
  fogOfWar.active,
1962
1983
  opts && opts.initialHydration === true,
@@ -1981,7 +2002,12 @@ function createRouter(init) {
1981
2002
  }
1982
2003
  matches = actionResult.matches || matches;
1983
2004
  pendingActionResult = actionResult.pendingActionResult;
1984
- loadingNavigation = getLoadingNavigation(location, opts.submission);
2005
+ loadingNavigation = getLoadingNavigation(
2006
+ location,
2007
+ matches,
2008
+ historyAction,
2009
+ opts.submission
2010
+ );
1985
2011
  flushSync = false;
1986
2012
  fogOfWar.active = false;
1987
2013
  request = createClientSideRequest(
@@ -1994,11 +2020,13 @@ function createRouter(init) {
1994
2020
  shortCircuited,
1995
2021
  matches: updatedMatches,
1996
2022
  loaderData,
1997
- errors
2023
+ errors,
2024
+ workingFetchers
1998
2025
  } = await handleLoaders(
1999
2026
  request,
2000
2027
  location,
2001
2028
  matches,
2029
+ historyAction,
2002
2030
  scopedContext,
2003
2031
  fogOfWar.active,
2004
2032
  loadingNavigation,
@@ -2018,12 +2046,18 @@ function createRouter(init) {
2018
2046
  matches: updatedMatches || matches,
2019
2047
  ...getActionDataForCommit(pendingActionResult),
2020
2048
  loaderData,
2021
- errors
2049
+ errors,
2050
+ ...workingFetchers ? { fetchers: workingFetchers } : {}
2022
2051
  });
2023
2052
  }
2024
- async function handleAction(request, location, submission, matches, scopedContext, isFogOfWar, initialHydration, opts = {}) {
2053
+ async function handleAction(request, location, submission, matches, historyAction, scopedContext, isFogOfWar, initialHydration, opts = {}) {
2025
2054
  interruptActiveLoads();
2026
- let navigation = getSubmittingNavigation(location, submission);
2055
+ let navigation = getSubmittingNavigation(
2056
+ location,
2057
+ matches,
2058
+ historyAction,
2059
+ submission
2060
+ );
2027
2061
  updateState({ navigation }, { flushSync: opts.flushSync === true });
2028
2062
  if (isFogOfWar) {
2029
2063
  let discoverResult = await discoverRoutes(
@@ -2158,8 +2192,8 @@ function createRouter(init) {
2158
2192
  pendingActionResult: [actionMatch.route.id, result]
2159
2193
  };
2160
2194
  }
2161
- async function handleLoaders(request, location, matches, scopedContext, isFogOfWar, overrideNavigation, submission, fetcherSubmission, replace2, initialHydration, flushSync, pendingActionResult, callSiteDefaultShouldRevalidate) {
2162
- let loadingNavigation = overrideNavigation || getLoadingNavigation(location, submission);
2195
+ async function handleLoaders(request, location, matches, historyAction, scopedContext, isFogOfWar, overrideNavigation, submission, fetcherSubmission, replace2, initialHydration, flushSync, pendingActionResult, callSiteDefaultShouldRevalidate) {
2196
+ let loadingNavigation = overrideNavigation || getLoadingNavigation(location, matches, historyAction, submission);
2163
2197
  let activeSubmission = submission || fetcherSubmission || getSubmissionFromNavigation(loadingNavigation);
2164
2198
  let shouldUpdateNavigationState = !isUninterruptedRevalidation && !initialHydration;
2165
2199
  if (isFogOfWar) {
@@ -2247,7 +2281,8 @@ function createRouter(init) {
2247
2281
  if (!init.dataStrategy && !dsMatches.some((m) => m.shouldLoad) && !dsMatches.some(
2248
2282
  (m) => m.route.middleware && m.route.middleware.length > 0
2249
2283
  ) && revalidatingFetchers.length === 0) {
2250
- let updatedFetchers2 = markFetchRedirectsDone();
2284
+ let workingFetchers2 = new Map(state.fetchers);
2285
+ let didUpdateFetcherRedirects2 = markFetchRedirectsDone(workingFetchers2);
2251
2286
  completeNavigation(
2252
2287
  location,
2253
2288
  {
@@ -2256,7 +2291,7 @@ function createRouter(init) {
2256
2291
  // Commit pending error if we're short circuiting
2257
2292
  errors: pendingActionResult && isErrorResult(pendingActionResult[1]) ? { [pendingActionResult[0]]: pendingActionResult[1].error } : null,
2258
2293
  ...getActionDataForCommit(pendingActionResult),
2259
- ...updatedFetchers2 ? { fetchers: new Map(state.fetchers) } : {}
2294
+ ...didUpdateFetcherRedirects2 ? { fetchers: workingFetchers2 } : {}
2260
2295
  },
2261
2296
  { flushSync }
2262
2297
  );
@@ -2321,25 +2356,30 @@ function createRouter(init) {
2321
2356
  });
2322
2357
  return { shortCircuited: true };
2323
2358
  }
2359
+ let workingFetchers = new Map(state.fetchers);
2324
2360
  let { loaderData, errors } = processLoaderData(
2325
2361
  state,
2326
2362
  matches,
2327
2363
  loaderResults,
2328
2364
  pendingActionResult,
2329
2365
  revalidatingFetchers,
2330
- fetcherResults
2366
+ fetcherResults,
2367
+ workingFetchers
2331
2368
  );
2332
2369
  if (initialHydration && state.errors) {
2333
2370
  errors = { ...state.errors, ...errors };
2334
2371
  }
2335
- let updatedFetchers = markFetchRedirectsDone();
2336
- let didAbortFetchLoads = abortStaleFetchLoads(pendingNavigationLoadId);
2337
- let shouldUpdateFetchers = updatedFetchers || didAbortFetchLoads || revalidatingFetchers.length > 0;
2372
+ let didUpdateFetcherRedirects = markFetchRedirectsDone(workingFetchers);
2373
+ let didAbortFetchLoads = abortStaleFetchLoads(
2374
+ pendingNavigationLoadId,
2375
+ workingFetchers
2376
+ );
2377
+ let shouldUpdateFetchers = didUpdateFetcherRedirects || didAbortFetchLoads || revalidatingFetchers.length > 0;
2338
2378
  return {
2339
2379
  matches,
2340
2380
  loaderData,
2341
2381
  errors,
2342
- ...shouldUpdateFetchers ? { fetchers: new Map(state.fetchers) } : {}
2382
+ ...shouldUpdateFetchers ? { workingFetchers } : {}
2343
2383
  };
2344
2384
  }
2345
2385
  function getUpdatedActionData(pendingActionResult) {
@@ -2356,15 +2396,16 @@ function createRouter(init) {
2356
2396
  }
2357
2397
  }
2358
2398
  function getUpdatedRevalidatingFetchers(revalidatingFetchers) {
2399
+ let workingFetchers = new Map(state.fetchers);
2359
2400
  revalidatingFetchers.forEach((rf) => {
2360
- let fetcher = state.fetchers.get(rf.key);
2401
+ let fetcher = workingFetchers.get(rf.key);
2361
2402
  let revalidatingFetcher = getLoadingFetcher(
2362
2403
  void 0,
2363
2404
  fetcher ? fetcher.data : void 0
2364
2405
  );
2365
- state.fetchers.set(rf.key, revalidatingFetcher);
2406
+ workingFetchers.set(rf.key, revalidatingFetcher);
2366
2407
  });
2367
- return new Map(state.fetchers);
2408
+ return workingFetchers;
2368
2409
  }
2369
2410
  async function fetch2(key, routeId, href, opts) {
2370
2411
  abortFetcher(key);
@@ -2561,8 +2602,6 @@ function createRouter(init) {
2561
2602
  invariant(matches, "Didn't find any matches after fetcher action");
2562
2603
  let loadId = ++incrementingLoadId;
2563
2604
  fetchReloadIds.set(key, loadId);
2564
- let loadFetcher = getLoadingFetcher(submission, actionResult.data);
2565
- state.fetchers.set(key, loadFetcher);
2566
2605
  let { dsMatches, revalidatingFetchers } = getMatchesToLoad(
2567
2606
  revalidationRequest,
2568
2607
  scopedContext,
@@ -2587,20 +2626,23 @@ function createRouter(init) {
2587
2626
  [match.route.id, actionResult],
2588
2627
  callSiteDefaultShouldRevalidate
2589
2628
  );
2629
+ let loadFetcher = getLoadingFetcher(submission, actionResult.data);
2630
+ let workingFetchers = new Map(state.fetchers);
2631
+ workingFetchers.set(key, loadFetcher);
2590
2632
  revalidatingFetchers.filter((rf) => rf.key !== key).forEach((rf) => {
2591
2633
  let staleKey = rf.key;
2592
- let existingFetcher2 = state.fetchers.get(staleKey);
2634
+ let existingFetcher2 = workingFetchers.get(staleKey);
2593
2635
  let revalidatingFetcher = getLoadingFetcher(
2594
2636
  void 0,
2595
2637
  existingFetcher2 ? existingFetcher2.data : void 0
2596
2638
  );
2597
- state.fetchers.set(staleKey, revalidatingFetcher);
2639
+ workingFetchers.set(staleKey, revalidatingFetcher);
2598
2640
  abortFetcher(staleKey);
2599
2641
  if (rf.controller) {
2600
2642
  fetchControllers.set(staleKey, rf.controller);
2601
2643
  }
2602
2644
  });
2603
- updateState({ fetchers: new Map(state.fetchers) });
2645
+ updateState({ fetchers: workingFetchers });
2604
2646
  let abortPendingFetchRevalidations = () => revalidatingFetchers.forEach((rf) => abortFetcher(rf.key));
2605
2647
  abortController.signal.addEventListener(
2606
2648
  "abort",
@@ -2623,12 +2665,16 @@ function createRouter(init) {
2623
2665
  fetchReloadIds.delete(key);
2624
2666
  fetchControllers.delete(key);
2625
2667
  revalidatingFetchers.forEach((r) => fetchControllers.delete(r.key));
2626
- if (state.fetchers.has(key)) {
2627
- let doneFetcher = getDoneFetcher(actionResult.data);
2628
- state.fetchers.set(key, doneFetcher);
2629
- }
2668
+ let fetcherIsMounted = state.fetchers.has(key);
2669
+ let getRedirectStateWithDoneFetcher = (s) => {
2670
+ if (!fetcherIsMounted) return s;
2671
+ let workingFetchers2 = new Map(s.fetchers);
2672
+ workingFetchers2.set(key, getDoneFetcher(actionResult.data));
2673
+ return { ...s, fetchers: workingFetchers2 };
2674
+ };
2630
2675
  let redirect2 = findRedirect(loaderResults);
2631
2676
  if (redirect2) {
2677
+ state = getRedirectStateWithDoneFetcher(state);
2632
2678
  return startRedirectNavigation(
2633
2679
  revalidationRequest,
2634
2680
  redirect2.result,
@@ -2639,6 +2685,7 @@ function createRouter(init) {
2639
2685
  redirect2 = findRedirect(fetcherResults);
2640
2686
  if (redirect2) {
2641
2687
  fetchRedirectIds.add(redirect2.key);
2688
+ state = getRedirectStateWithDoneFetcher(state);
2642
2689
  return startRedirectNavigation(
2643
2690
  revalidationRequest,
2644
2691
  redirect2.result,
@@ -2646,15 +2693,20 @@ function createRouter(init) {
2646
2693
  { preventScrollReset }
2647
2694
  );
2648
2695
  }
2696
+ let finalFetchers = new Map(state.fetchers);
2697
+ if (fetcherIsMounted) {
2698
+ finalFetchers.set(key, getDoneFetcher(actionResult.data));
2699
+ }
2649
2700
  let { loaderData, errors } = processLoaderData(
2650
2701
  state,
2651
2702
  matches,
2652
2703
  loaderResults,
2653
2704
  void 0,
2654
2705
  revalidatingFetchers,
2655
- fetcherResults
2706
+ fetcherResults,
2707
+ finalFetchers
2656
2708
  );
2657
- abortStaleFetchLoads(loadId);
2709
+ abortStaleFetchLoads(loadId, finalFetchers);
2658
2710
  if (state.navigation.state === "loading" && loadId > pendingNavigationLoadId) {
2659
2711
  invariant(pendingAction, "Expected pending action");
2660
2712
  pendingNavigationController && pendingNavigationController.abort();
@@ -2662,7 +2714,7 @@ function createRouter(init) {
2662
2714
  matches,
2663
2715
  loaderData,
2664
2716
  errors,
2665
- fetchers: new Map(state.fetchers)
2717
+ fetchers: finalFetchers
2666
2718
  });
2667
2719
  } else {
2668
2720
  updateState({
@@ -2673,7 +2725,7 @@ function createRouter(init) {
2673
2725
  matches,
2674
2726
  errors
2675
2727
  ),
2676
- fetchers: new Map(state.fetchers)
2728
+ fetchers: finalFetchers
2677
2729
  });
2678
2730
  isRevalidationRequired = false;
2679
2731
  }
@@ -2838,6 +2890,8 @@ function createRouter(init) {
2838
2890
  } else {
2839
2891
  let overrideNavigation = getLoadingNavigation(
2840
2892
  redirectLocation,
2893
+ [],
2894
+ redirectNavigationType,
2841
2895
  submission
2842
2896
  );
2843
2897
  await startNavigation(redirectNavigationType, redirectLocation, {
@@ -2961,21 +3015,23 @@ function createRouter(init) {
2961
3015
  });
2962
3016
  }
2963
3017
  function updateFetcherState(key, fetcher, opts = {}) {
2964
- state.fetchers.set(key, fetcher);
3018
+ let workingFetchers = new Map(state.fetchers);
3019
+ workingFetchers.set(key, fetcher);
2965
3020
  updateState(
2966
- { fetchers: new Map(state.fetchers) },
3021
+ { fetchers: workingFetchers },
2967
3022
  { flushSync: (opts && opts.flushSync) === true }
2968
3023
  );
2969
3024
  }
2970
3025
  function setFetcherError(key, routeId, error, opts = {}) {
2971
3026
  let boundaryMatch = findNearestBoundary(state.matches, routeId);
2972
- deleteFetcher(key);
3027
+ let workingFetchers = new Map(state.fetchers);
3028
+ deleteFetcher(workingFetchers, key);
2973
3029
  updateState(
2974
3030
  {
2975
3031
  errors: {
2976
3032
  [boundaryMatch.route.id]: error
2977
3033
  },
2978
- fetchers: new Map(state.fetchers)
3034
+ fetchers: workingFetchers
2979
3035
  },
2980
3036
  { flushSync: (opts && opts.flushSync) === true }
2981
3037
  );
@@ -2991,7 +3047,7 @@ function createRouter(init) {
2991
3047
  abortFetcher(key, _optionalChain([opts, 'optionalAccess', _28 => _28.reason]));
2992
3048
  updateFetcherState(key, getDoneFetcher(null));
2993
3049
  }
2994
- function deleteFetcher(key) {
3050
+ function deleteFetcher(fetchers, key) {
2995
3051
  let fetcher = state.fetchers.get(key);
2996
3052
  if (fetchControllers.has(key) && !(fetcher && fetcher.state === "loading" && fetchReloadIds.has(key))) {
2997
3053
  abortFetcher(key);
@@ -3001,7 +3057,7 @@ function createRouter(init) {
3001
3057
  fetchRedirectIds.delete(key);
3002
3058
  fetchersQueuedForDeletion.delete(key);
3003
3059
  cancelledFetcherLoads.delete(key);
3004
- state.fetchers.delete(key);
3060
+ fetchers.delete(key);
3005
3061
  }
3006
3062
  function queueFetcherForDeletion(key) {
3007
3063
  let count = (activeFetchers.get(key) || 0) - 1;
@@ -3020,33 +3076,34 @@ function createRouter(init) {
3020
3076
  fetchControllers.delete(key);
3021
3077
  }
3022
3078
  }
3023
- function markFetchersDone(keys) {
3079
+ function markFetchersDone(keys, fetchers) {
3024
3080
  for (let key of keys) {
3025
- let fetcher = getFetcher(key);
3081
+ let fetcher = fetchers.get(key);
3082
+ invariant(fetcher, `Expected fetcher: ${key}`);
3026
3083
  let doneFetcher = getDoneFetcher(fetcher.data);
3027
- state.fetchers.set(key, doneFetcher);
3084
+ fetchers.set(key, doneFetcher);
3028
3085
  }
3029
3086
  }
3030
- function markFetchRedirectsDone() {
3087
+ function markFetchRedirectsDone(fetchers) {
3031
3088
  let doneKeys = [];
3032
- let updatedFetchers = false;
3089
+ let didUpdateFetchers = false;
3033
3090
  for (let key of fetchRedirectIds) {
3034
- let fetcher = state.fetchers.get(key);
3091
+ let fetcher = fetchers.get(key);
3035
3092
  invariant(fetcher, `Expected fetcher: ${key}`);
3036
3093
  if (fetcher.state === "loading") {
3037
3094
  fetchRedirectIds.delete(key);
3038
3095
  doneKeys.push(key);
3039
- updatedFetchers = true;
3096
+ didUpdateFetchers = true;
3040
3097
  }
3041
3098
  }
3042
- markFetchersDone(doneKeys);
3043
- return updatedFetchers;
3099
+ markFetchersDone(doneKeys, fetchers);
3100
+ return didUpdateFetchers;
3044
3101
  }
3045
- function abortStaleFetchLoads(landedId) {
3102
+ function abortStaleFetchLoads(landedId, fetchers) {
3046
3103
  let yeetedKeys = [];
3047
3104
  for (let [key, id] of fetchReloadIds) {
3048
3105
  if (id < landedId) {
3049
- let fetcher = state.fetchers.get(key);
3106
+ let fetcher = fetchers.get(key);
3050
3107
  invariant(fetcher, `Expected fetcher: ${key}`);
3051
3108
  if (fetcher.state === "loading") {
3052
3109
  abortFetcher(key);
@@ -3055,7 +3112,7 @@ function createRouter(init) {
3055
3112
  }
3056
3113
  }
3057
3114
  }
3058
- markFetchersDone(yeetedKeys);
3115
+ markFetchersDone(yeetedKeys, fetchers);
3059
3116
  return yeetedKeys.length > 0;
3060
3117
  }
3061
3118
  function getBlocker(key, fn) {
@@ -5283,7 +5340,7 @@ function processRouteLoaderData(matches, results, pendingActionResult, isStaticH
5283
5340
  loaderHeaders
5284
5341
  };
5285
5342
  }
5286
- function processLoaderData(state, matches, results, pendingActionResult, revalidatingFetchers, fetcherResults) {
5343
+ function processLoaderData(state, matches, results, pendingActionResult, revalidatingFetchers, fetcherResults, workingFetchers) {
5287
5344
  let { loaderData, errors } = processRouteLoaderData(
5288
5345
  matches,
5289
5346
  results,
@@ -5304,12 +5361,12 @@ function processLoaderData(state, matches, results, pendingActionResult, revalid
5304
5361
  [boundaryMatch.route.id]: result.error
5305
5362
  };
5306
5363
  }
5307
- state.fetchers.delete(key);
5364
+ workingFetchers.delete(key);
5308
5365
  } else if (isRedirectResult(result)) {
5309
5366
  invariant(false, "Unhandled fetcher revalidation redirect");
5310
5367
  } else {
5311
5368
  let doneFetcher = getDoneFetcher(result.data);
5312
- state.fetchers.set(key, doneFetcher);
5369
+ workingFetchers.set(key, doneFetcher);
5313
5370
  }
5314
5371
  });
5315
5372
  return { loaderData, errors };
@@ -5516,11 +5573,13 @@ function getSubmissionFromNavigation(navigation) {
5516
5573
  };
5517
5574
  }
5518
5575
  }
5519
- function getLoadingNavigation(location, submission) {
5576
+ function getLoadingNavigation(location, matches, historyAction, submission) {
5520
5577
  if (submission) {
5521
5578
  let navigation = {
5522
5579
  state: "loading",
5523
5580
  location,
5581
+ matches,
5582
+ historyAction,
5524
5583
  formMethod: submission.formMethod,
5525
5584
  formAction: submission.formAction,
5526
5585
  formEncType: submission.formEncType,
@@ -5533,6 +5592,8 @@ function getLoadingNavigation(location, submission) {
5533
5592
  let navigation = {
5534
5593
  state: "loading",
5535
5594
  location,
5595
+ matches,
5596
+ historyAction,
5536
5597
  formMethod: void 0,
5537
5598
  formAction: void 0,
5538
5599
  formEncType: void 0,
@@ -5543,10 +5604,12 @@ function getLoadingNavigation(location, submission) {
5543
5604
  return navigation;
5544
5605
  }
5545
5606
  }
5546
- function getSubmittingNavigation(location, submission) {
5607
+ function getSubmittingNavigation(location, matches, historyAction, submission) {
5547
5608
  let navigation = {
5548
5609
  state: "submitting",
5549
5610
  location,
5611
+ matches,
5612
+ historyAction,
5550
5613
  formMethod: submission.formMethod,
5551
5614
  formAction: submission.formAction,
5552
5615
  formEncType: submission.formEncType,
@@ -7537,7 +7600,10 @@ function useRouteId() {
7537
7600
  }
7538
7601
  function useNavigation() {
7539
7602
  let state = useDataRouterState("useNavigation" /* UseNavigation */);
7540
- return state.navigation;
7603
+ return React3.useMemo(() => {
7604
+ let { matches, historyAction, ...rest } = state.navigation;
7605
+ return rest;
7606
+ }, [state.navigation]);
7541
7607
  }
7542
7608
  function useRevalidator() {
7543
7609
  let dataRouterContext = useDataRouterContext("useRevalidator" /* UseRevalidator */);
@@ -7672,6 +7738,65 @@ function useRoute(...args) {
7672
7738
  actionData: _optionalChain([state, 'access', _101 => _101.actionData, 'optionalAccess', _102 => _102[id]])
7673
7739
  };
7674
7740
  }
7741
+ function toRouterStateMatch(match) {
7742
+ return {
7743
+ id: match.route.id,
7744
+ pathname: match.pathname,
7745
+ params: match.params,
7746
+ handle: match.route.handle
7747
+ };
7748
+ }
7749
+ function useRouterState() {
7750
+ let {
7751
+ location,
7752
+ historyAction: type,
7753
+ matches,
7754
+ navigation
7755
+ } = useDataRouterState("unstable_useRouterState" /* UseRouterState */);
7756
+ let active = React3.useMemo(
7757
+ () => ({
7758
+ type,
7759
+ location,
7760
+ searchParams: new URLSearchParams(location.search),
7761
+ params: _nullishCoalesce(_optionalChain([matches, 'access', _103 => _103[matches.length - 1], 'optionalAccess', _104 => _104.params]), () => ( {})),
7762
+ matches: matches.map((m) => toRouterStateMatch(m))
7763
+ }),
7764
+ [location, matches, type]
7765
+ );
7766
+ let pending = React3.useMemo(() => {
7767
+ if (navigation.state === "idle") return null;
7768
+ let shared = {
7769
+ type: navigation.historyAction,
7770
+ location: navigation.location,
7771
+ searchParams: new URLSearchParams(navigation.location.search),
7772
+ params: _nullishCoalesce(_optionalChain([navigation, 'access', _105 => _105.matches, 'access', _106 => _106[navigation.matches.length - 1], 'optionalAccess', _107 => _107.params]), () => ( {})),
7773
+ matches: navigation.matches.map((m) => toRouterStateMatch(m))
7774
+ };
7775
+ return navigation.state === "loading" ? {
7776
+ ...shared,
7777
+ state: "loading",
7778
+ formMethod: navigation.formMethod,
7779
+ formAction: navigation.formAction,
7780
+ formEncType: navigation.formEncType,
7781
+ formData: navigation.formData,
7782
+ json: navigation.json,
7783
+ text: navigation.text
7784
+ } : {
7785
+ ...shared,
7786
+ state: "submitting",
7787
+ formMethod: navigation.formMethod,
7788
+ formAction: navigation.formAction,
7789
+ formEncType: navigation.formEncType,
7790
+ formData: navigation.formData,
7791
+ json: navigation.json,
7792
+ text: navigation.text
7793
+ };
7794
+ }, [navigation]);
7795
+ return React3.useMemo(
7796
+ () => ({ active, pending }),
7797
+ [active, pending]
7798
+ );
7799
+ }
7675
7800
 
7676
7801
  // lib/dom/ssr/errorBoundaries.tsx
7677
7802
 
@@ -7714,7 +7839,7 @@ function getKeyedLinksForMatches(matches, routeModules, manifest) {
7714
7839
  let route = manifest.routes[match.route.id];
7715
7840
  return [
7716
7841
  route && route.css ? route.css.map((href) => ({ rel: "stylesheet", href })) : [],
7717
- _optionalChain([module, 'optionalAccess', _103 => _103.links, 'optionalCall', _104 => _104()]) || []
7842
+ _optionalChain([module, 'optionalAccess', _108 => _108.links, 'optionalCall', _109 => _109()]) || []
7718
7843
  ];
7719
7844
  }).flat(2);
7720
7845
  let preloads = getModuleLinkHrefs(matches, manifest);
@@ -7815,7 +7940,7 @@ function getNewMatchesForLinks(page, nextMatches, currentMatches, manifest, loca
7815
7940
  // param change, /users/123 -> /users/456
7816
7941
  currentMatches[index].pathname !== match.pathname || // splat param changed, which is not present in match.path
7817
7942
  // e.g. /files/images/avatar.jpg -> files/finances.xls
7818
- _optionalChain([currentMatches, 'access', _105 => _105[index], 'access', _106 => _106.route, 'access', _107 => _107.path, 'optionalAccess', _108 => _108.endsWith, 'call', _109 => _109("*")]) && currentMatches[index].params["*"] !== match.params["*"]
7943
+ _optionalChain([currentMatches, 'access', _110 => _110[index], 'access', _111 => _111.route, 'access', _112 => _112.path, 'optionalAccess', _113 => _113.endsWith, 'call', _114 => _114("*")]) && currentMatches[index].params["*"] !== match.params["*"]
7819
7944
  );
7820
7945
  };
7821
7946
  if (mode === "assets") {
@@ -7838,7 +7963,7 @@ function getNewMatchesForLinks(page, nextMatches, currentMatches, manifest, loca
7838
7963
  location.pathname + location.search + location.hash,
7839
7964
  window.origin
7840
7965
  ),
7841
- currentParams: _optionalChain([currentMatches, 'access', _110 => _110[0], 'optionalAccess', _111 => _111.params]) || {},
7966
+ currentParams: _optionalChain([currentMatches, 'access', _115 => _115[0], 'optionalAccess', _116 => _116.params]) || {},
7842
7967
  nextUrl: new URL(page, window.origin),
7843
7968
  nextParams: match.params,
7844
7969
  defaultShouldRevalidate: true
@@ -8110,44 +8235,42 @@ function createClientRoutes(manifest, routeModulesCache, initialState, ssr, isSp
8110
8235
  )
8111
8236
  });
8112
8237
  let hasInitialData = initialState && initialState.loaderData && route.id in initialState.loaderData;
8113
- let initialData = hasInitialData ? _optionalChain([initialState, 'optionalAccess', _112 => _112.loaderData, 'optionalAccess', _113 => _113[route.id]]) : void 0;
8238
+ let initialData = hasInitialData ? _optionalChain([initialState, 'optionalAccess', _117 => _117.loaderData, 'optionalAccess', _118 => _118[route.id]]) : void 0;
8114
8239
  let hasInitialError = initialState && initialState.errors && route.id in initialState.errors;
8115
- let initialError = hasInitialError ? _optionalChain([initialState, 'optionalAccess', _114 => _114.errors, 'optionalAccess', _115 => _115[route.id]]) : void 0;
8116
- let isHydrationRequest = needsRevalidation == null && (_optionalChain([routeModule, 'access', _116 => _116.clientLoader, 'optionalAccess', _117 => _117.hydrate]) === true || !route.hasLoader);
8240
+ let initialError = hasInitialError ? _optionalChain([initialState, 'optionalAccess', _119 => _119.errors, 'optionalAccess', _120 => _120[route.id]]) : void 0;
8241
+ let isHydrationRequest = needsRevalidation == null && (_optionalChain([routeModule, 'access', _121 => _121.clientLoader, 'optionalAccess', _122 => _122.hydrate]) === true || !route.hasLoader);
8117
8242
  dataRoute.loader = async ({ request, params, context, pattern, url }, singleFetch) => {
8118
- try {
8119
- let result = await prefetchStylesAndCallHandler(async () => {
8120
- invariant2(
8121
- routeModule,
8122
- "No `routeModule` available for critical-route loader"
8123
- );
8124
- if (!routeModule.clientLoader) {
8125
- return fetchServerLoader(singleFetch);
8126
- }
8127
- return routeModule.clientLoader({
8128
- request,
8129
- params,
8130
- context,
8131
- pattern,
8132
- url,
8133
- async serverLoader() {
8134
- preventInvalidServerHandlerCall("loader", route);
8135
- if (isHydrationRequest) {
8136
- if (hasInitialData) {
8137
- return initialData;
8138
- }
8139
- if (hasInitialError) {
8140
- throw initialError;
8141
- }
8243
+ let _isHydrationRequest = isHydrationRequest;
8244
+ isHydrationRequest = false;
8245
+ let result = await prefetchStylesAndCallHandler(async () => {
8246
+ invariant2(
8247
+ routeModule,
8248
+ "No `routeModule` available for critical-route loader"
8249
+ );
8250
+ if (!routeModule.clientLoader) {
8251
+ return fetchServerLoader(singleFetch);
8252
+ }
8253
+ return routeModule.clientLoader({
8254
+ request,
8255
+ params,
8256
+ context,
8257
+ pattern,
8258
+ url,
8259
+ async serverLoader() {
8260
+ preventInvalidServerHandlerCall("loader", route);
8261
+ if (_isHydrationRequest) {
8262
+ if (hasInitialData) {
8263
+ return initialData;
8264
+ }
8265
+ if (hasInitialError) {
8266
+ throw initialError;
8142
8267
  }
8143
- return fetchServerLoader(singleFetch);
8144
8268
  }
8145
- });
8269
+ return fetchServerLoader(singleFetch);
8270
+ }
8146
8271
  });
8147
- return result;
8148
- } finally {
8149
- isHydrationRequest = false;
8150
- }
8272
+ });
8273
+ return result;
8151
8274
  };
8152
8275
  dataRoute.loader.hydrate = shouldHydrateRouteLoader(
8153
8276
  route.id,
@@ -8416,7 +8539,7 @@ function getPatchRoutesOnNavigationFunction(getRouter, manifest, routeModules, s
8416
8539
  function useFogOFWarDiscovery(router, manifest, routeModules, ssr, routeDiscovery, isSpaMode) {
8417
8540
  React6.useEffect(() => {
8418
8541
  if (!isFogOfWarEnabled(routeDiscovery, ssr) || // @ts-expect-error - TS doesn't know about this yet
8419
- _optionalChain([window, 'access', _118 => _118.navigator, 'optionalAccess', _119 => _119.connection, 'optionalAccess', _120 => _120.saveData]) === true) {
8542
+ _optionalChain([window, 'access', _123 => _123.navigator, 'optionalAccess', _124 => _124.connection, 'optionalAccess', _125 => _125.saveData]) === true) {
8420
8543
  return;
8421
8544
  }
8422
8545
  function registerElement(el) {
@@ -8522,7 +8645,7 @@ async function fetchAndApplyManifestPatches(paths, errorReloadPath, manifest, ro
8522
8645
  }
8523
8646
  serverPatches = await res.json();
8524
8647
  } catch (e) {
8525
- if (_optionalChain([signal, 'optionalAccess', _121 => _121.aborted])) return;
8648
+ if (_optionalChain([signal, 'optionalAccess', _126 => _126.aborted])) return;
8526
8649
  throw e;
8527
8650
  }
8528
8651
  let knownRoutes = new Set(Object.keys(manifest.routes));
@@ -8825,7 +8948,7 @@ function PrefetchPageLinksImpl({
8825
8948
  if (!manifestRoute || !manifestRoute.hasLoader) {
8826
8949
  return;
8827
8950
  }
8828
- if (!newMatchesForData.some((m2) => m2.route.id === m.route.id) && m.route.id in loaderData && _optionalChain([routeModules, 'access', _122 => _122[m.route.id], 'optionalAccess', _123 => _123.shouldRevalidate])) {
8951
+ if (!newMatchesForData.some((m2) => m2.route.id === m.route.id) && m.route.id in loaderData && _optionalChain([routeModules, 'access', _127 => _127[m.route.id], 'optionalAccess', _128 => _128.shouldRevalidate])) {
8829
8952
  foundOptOutRoute = true;
8830
8953
  } else if (manifestRoute.hasClientLoader) {
8831
8954
  foundOptOutRoute = true;
@@ -8913,7 +9036,7 @@ function Meta() {
8913
9036
  error
8914
9037
  };
8915
9038
  matches[i] = match;
8916
- if (_optionalChain([routeModule, 'optionalAccess', _124 => _124.meta])) {
9039
+ if (_optionalChain([routeModule, 'optionalAccess', _129 => _129.meta])) {
8917
9040
  routeMeta = typeof routeModule.meta === "function" ? routeModule.meta({
8918
9041
  data: data2,
8919
9042
  loaderData: data2,
@@ -8972,7 +9095,7 @@ function Meta() {
8972
9095
  dangerouslySetInnerHTML: { __html: escapeHtml(json) }
8973
9096
  }
8974
9097
  );
8975
- } catch (err) {
9098
+ } catch (e) {
8976
9099
  return null;
8977
9100
  }
8978
9101
  }
@@ -9012,7 +9135,7 @@ function Scripts(scriptProps) {
9012
9135
  }
9013
9136
  let streamScript = "window.__reactRouterContext.stream = new ReadableStream({start(controller){window.__reactRouterContext.streamController = controller;}}).pipeThrough(new TextEncoderStream());";
9014
9137
  let contextScript = staticContext ? `window.__reactRouterContext = ${serverHandoffString};${streamScript}` : " ";
9015
- let routeModulesScript = !isStatic ? " " : `${_optionalChain([manifest, 'access', _125 => _125.hmr, 'optionalAccess', _126 => _126.runtime]) ? `import ${JSON.stringify(manifest.hmr.runtime)};` : ""}${!enableFogOfWar ? `import ${JSON.stringify(manifest.url)}` : ""};
9138
+ let routeModulesScript = !isStatic ? " " : `${_optionalChain([manifest, 'access', _130 => _130.hmr, 'optionalAccess', _131 => _131.runtime]) ? `import ${JSON.stringify(manifest.hmr.runtime)};` : ""}${!enableFogOfWar ? `import ${JSON.stringify(manifest.url)}` : ""};
9016
9139
  ${matches.map((match, routeIndex) => {
9017
9140
  let routeVarName = `route${routeIndex}`;
9018
9141
  let manifestEntry = manifest.routes[match.route.id];
@@ -9088,13 +9211,16 @@ import(${JSON.stringify(manifest.entry.module)});`;
9088
9211
  }
9089
9212
  ));
9090
9213
  }, []);
9091
- let preloads = isHydrated || isRSCRouterContext ? [] : dedupe(
9092
- manifest.entry.imports.concat(
9093
- getModuleLinkHrefs(matches, manifest, {
9094
- includeHydrateFallback: true
9095
- })
9214
+ let preloads = isHydrated || isRSCRouterContext ? [] : [
9215
+ // Dedupe through a Set
9216
+ ...new Set(
9217
+ manifest.entry.imports.concat(
9218
+ getModuleLinkHrefs(matches, manifest, {
9219
+ includeHydrateFallback: true
9220
+ })
9221
+ )
9096
9222
  )
9097
- );
9223
+ ];
9098
9224
  let sri = typeof manifest.sri === "object" ? manifest.sri : {};
9099
9225
  warnOnce(
9100
9226
  !isRSCRouterContext,
@@ -9146,9 +9272,6 @@ import(${JSON.stringify(manifest.entry.module)});`;
9146
9272
  }
9147
9273
  )), initialScripts);
9148
9274
  }
9149
- function dedupe(array) {
9150
- return [...new Set(array)];
9151
- }
9152
9275
  function mergeRefs(...refs) {
9153
9276
  return (value) => {
9154
9277
  refs.forEach((ref) => {
@@ -9246,7 +9369,7 @@ function BoundaryShell({
9246
9369
  children
9247
9370
  }) {
9248
9371
  let { routeModules } = useFrameworkContext();
9249
- if (_optionalChain([routeModules, 'access', _127 => _127.root, 'optionalAccess', _128 => _128.Layout]) && !isOutsideRemixApp) {
9372
+ if (_optionalChain([routeModules, 'access', _132 => _132.root, 'optionalAccess', _133 => _133.Layout]) && !isOutsideRemixApp) {
9250
9373
  return children;
9251
9374
  }
9252
9375
  return /* @__PURE__ */ React8.createElement("html", { lang: "en" }, /* @__PURE__ */ React8.createElement("head", null, /* @__PURE__ */ React8.createElement("meta", { charSet: "utf-8" }), /* @__PURE__ */ React8.createElement(
@@ -9326,20 +9449,20 @@ var hydrationRouteProperties = [
9326
9449
  ];
9327
9450
  function createMemoryRouter(routes, opts) {
9328
9451
  return createRouter({
9329
- basename: _optionalChain([opts, 'optionalAccess', _129 => _129.basename]),
9330
- getContext: _optionalChain([opts, 'optionalAccess', _130 => _130.getContext]),
9331
- future: _optionalChain([opts, 'optionalAccess', _131 => _131.future]),
9452
+ basename: _optionalChain([opts, 'optionalAccess', _134 => _134.basename]),
9453
+ getContext: _optionalChain([opts, 'optionalAccess', _135 => _135.getContext]),
9454
+ future: _optionalChain([opts, 'optionalAccess', _136 => _136.future]),
9332
9455
  history: createMemoryHistory({
9333
- initialEntries: _optionalChain([opts, 'optionalAccess', _132 => _132.initialEntries]),
9334
- initialIndex: _optionalChain([opts, 'optionalAccess', _133 => _133.initialIndex])
9456
+ initialEntries: _optionalChain([opts, 'optionalAccess', _137 => _137.initialEntries]),
9457
+ initialIndex: _optionalChain([opts, 'optionalAccess', _138 => _138.initialIndex])
9335
9458
  }),
9336
- hydrationData: _optionalChain([opts, 'optionalAccess', _134 => _134.hydrationData]),
9459
+ hydrationData: _optionalChain([opts, 'optionalAccess', _139 => _139.hydrationData]),
9337
9460
  routes,
9338
9461
  hydrationRouteProperties,
9339
9462
  mapRouteProperties,
9340
- dataStrategy: _optionalChain([opts, 'optionalAccess', _135 => _135.dataStrategy]),
9341
- patchRoutesOnNavigation: _optionalChain([opts, 'optionalAccess', _136 => _136.patchRoutesOnNavigation]),
9342
- instrumentations: _optionalChain([opts, 'optionalAccess', _137 => _137.instrumentations])
9463
+ dataStrategy: _optionalChain([opts, 'optionalAccess', _140 => _140.dataStrategy]),
9464
+ patchRoutesOnNavigation: _optionalChain([opts, 'optionalAccess', _141 => _141.patchRoutesOnNavigation]),
9465
+ instrumentations: _optionalChain([opts, 'optionalAccess', _142 => _142.instrumentations])
9343
9466
  }).initialize();
9344
9467
  }
9345
9468
  var Deferred2 = class {
@@ -9385,7 +9508,7 @@ function RouterProvider({
9385
9508
  Object.values(newErrors).forEach(
9386
9509
  (error) => onError(error, {
9387
9510
  location: newState.location,
9388
- params: _nullishCoalesce(_optionalChain([newState, 'access', _138 => _138.matches, 'access', _139 => _139[0], 'optionalAccess', _140 => _140.params]), () => ( {})),
9511
+ params: _nullishCoalesce(_optionalChain([newState, 'access', _143 => _143.matches, 'access', _144 => _144[0], 'optionalAccess', _145 => _145.params]), () => ( {})),
9389
9512
  pattern: getRoutePattern(newState.matches)
9390
9513
  })
9391
9514
  );
@@ -9423,7 +9546,7 @@ function RouterProvider({
9423
9546
  if (reactDomFlushSyncImpl && flushSync) {
9424
9547
  reactDomFlushSyncImpl(() => {
9425
9548
  if (transition) {
9426
- _optionalChain([renderDfd, 'optionalAccess', _141 => _141.resolve, 'call', _142 => _142()]);
9549
+ _optionalChain([renderDfd, 'optionalAccess', _146 => _146.resolve, 'call', _147 => _147()]);
9427
9550
  transition.skipTransition();
9428
9551
  }
9429
9552
  setVtContext({
@@ -9448,7 +9571,7 @@ function RouterProvider({
9448
9571
  return;
9449
9572
  }
9450
9573
  if (transition) {
9451
- _optionalChain([renderDfd, 'optionalAccess', _143 => _143.resolve, 'call', _144 => _144()]);
9574
+ _optionalChain([renderDfd, 'optionalAccess', _148 => _148.resolve, 'call', _149 => _149()]);
9452
9575
  transition.skipTransition();
9453
9576
  setInterruption({
9454
9577
  state: newState,
@@ -9476,16 +9599,6 @@ function RouterProvider({
9476
9599
  ]
9477
9600
  );
9478
9601
  React9.useLayoutEffect(() => router.subscribe(setState), [router, setState]);
9479
- let initialized = state.initialized;
9480
- React9.useLayoutEffect(() => {
9481
- if (!initialized && router.state.initialized) {
9482
- setState(router.state, {
9483
- deletedFetchers: [],
9484
- flushSync: false,
9485
- newErrors: null
9486
- });
9487
- }
9488
- }, [initialized, setState, router.state]);
9489
9602
  React9.useEffect(() => {
9490
9603
  if (vtContext.isTransitioning && !vtContext.flushSync) {
9491
9604
  setRenderDfd(new Deferred2());
@@ -9547,12 +9660,12 @@ function RouterProvider({
9547
9660
  go: (n) => router.navigate(n),
9548
9661
  push: (to, state2, opts) => router.navigate(to, {
9549
9662
  state: state2,
9550
- preventScrollReset: _optionalChain([opts, 'optionalAccess', _145 => _145.preventScrollReset])
9663
+ preventScrollReset: _optionalChain([opts, 'optionalAccess', _150 => _150.preventScrollReset])
9551
9664
  }),
9552
9665
  replace: (to, state2, opts) => router.navigate(to, {
9553
9666
  replace: true,
9554
9667
  state: state2,
9555
- preventScrollReset: _optionalChain([opts, 'optionalAccess', _146 => _146.preventScrollReset])
9668
+ preventScrollReset: _optionalChain([opts, 'optionalAccess', _151 => _151.preventScrollReset])
9556
9669
  })
9557
9670
  };
9558
9671
  }, [router]);
@@ -9783,7 +9896,7 @@ function Await({
9783
9896
  if (dataRouterContext && dataRouterContext.onError && dataRouterStateContext) {
9784
9897
  dataRouterContext.onError(error, {
9785
9898
  location: dataRouterStateContext.location,
9786
- params: _optionalChain([dataRouterStateContext, 'access', _147 => _147.matches, 'access', _148 => _148[0], 'optionalAccess', _149 => _149.params]) || {},
9899
+ params: _optionalChain([dataRouterStateContext, 'access', _152 => _152.matches, 'access', _153 => _153[0], 'optionalAccess', _154 => _154.params]) || {},
9787
9900
  pattern: getRoutePattern(dataRouterStateContext.matches),
9788
9901
  errorInfo
9789
9902
  });
@@ -9845,7 +9958,7 @@ var AwaitErrorBoundary = class extends React9.Component {
9845
9958
  promise = resolve.then(
9846
9959
  (data2) => Object.defineProperty(resolve, "_data", { get: () => data2 }),
9847
9960
  (error) => {
9848
- _optionalChain([this, 'access', _150 => _150.props, 'access', _151 => _151.onError, 'optionalCall', _152 => _152(error)]);
9961
+ _optionalChain([this, 'access', _155 => _155.props, 'access', _156 => _156.onError, 'optionalCall', _157 => _157(error)]);
9849
9962
  Object.defineProperty(resolve, "_error", { get: () => error });
9850
9963
  }
9851
9964
  );
@@ -10112,4 +10225,5 @@ function withErrorBoundaryProps(ErrorBoundary) {
10112
10225
 
10113
10226
 
10114
10227
 
10115
- exports.Action = Action; exports.createMemoryHistory = createMemoryHistory; exports.createBrowserHistory = createBrowserHistory; exports.createHashHistory = createHashHistory; exports.invariant = invariant; exports.warning = warning; exports.createPath = createPath; exports.parsePath = parsePath; exports.createContext = createContext; exports.RouterContextProvider = RouterContextProvider; exports.convertRoutesToDataRoutes = convertRoutesToDataRoutes; exports.matchRoutes = matchRoutes; exports.matchRoutesImpl = matchRoutesImpl; exports.generatePath = generatePath; exports.matchPath = matchPath; exports.stripBasename = stripBasename; exports.resolvePath = resolvePath; exports.resolveTo = resolveTo; exports.joinPaths = joinPaths; exports.data = data; exports.redirect = redirect; exports.redirectDocument = redirectDocument; exports.replace = replace; exports.ErrorResponseImpl = ErrorResponseImpl; exports.isRouteErrorResponse = isRouteErrorResponse; exports.parseToInfo = parseToInfo; exports.escapeHtml = escapeHtml; exports.encode = encode; exports.instrumentHandler = instrumentHandler; exports.IDLE_NAVIGATION = IDLE_NAVIGATION; exports.IDLE_FETCHER = IDLE_FETCHER; exports.IDLE_BLOCKER = IDLE_BLOCKER; exports.createRouter = createRouter; exports.createStaticHandler = createStaticHandler; exports.getStaticContextFromError = getStaticContextFromError; exports.invalidProtocols = invalidProtocols; exports.isDataWithResponseInit = isDataWithResponseInit; exports.isResponse = isResponse; exports.isRedirectStatusCode = isRedirectStatusCode; exports.isRedirectResponse = isRedirectResponse; exports.isMutationMethod = isMutationMethod; exports.createRequestInit = createRequestInit; exports.SingleFetchRedirectSymbol = SingleFetchRedirectSymbol; exports.SINGLE_FETCH_REDIRECT_STATUS = SINGLE_FETCH_REDIRECT_STATUS; exports.NO_BODY_STATUS_CODES = NO_BODY_STATUS_CODES; exports.StreamTransfer = StreamTransfer; exports.getTurboStreamSingleFetchDataStrategy = getTurboStreamSingleFetchDataStrategy; exports.getSingleFetchDataStrategyImpl = getSingleFetchDataStrategyImpl; exports.stripIndexParam = stripIndexParam; exports.singleFetchUrl = singleFetchUrl; exports.decodeViaTurboStream = decodeViaTurboStream; exports.DataRouterContext = DataRouterContext; exports.DataRouterStateContext = DataRouterStateContext; exports.RSCRouterContext = RSCRouterContext; exports.ViewTransitionContext = ViewTransitionContext; exports.FetchersContext = FetchersContext; exports.AwaitContextProvider = AwaitContextProvider; exports.NavigationContext = NavigationContext; exports.LocationContext = LocationContext; exports.RouteContext = RouteContext; exports.ENABLE_DEV_WARNINGS = ENABLE_DEV_WARNINGS; exports.warnOnce = warnOnce; exports.decodeRedirectErrorDigest = decodeRedirectErrorDigest; exports.decodeRouteErrorResponseDigest = decodeRouteErrorResponseDigest; exports.useHref = useHref; exports.useInRouterContext = useInRouterContext; exports.useLocation = useLocation; exports.useNavigationType = useNavigationType; exports.useMatch = useMatch; exports.useNavigate = useNavigate; exports.useOutletContext = useOutletContext; exports.useOutlet = useOutlet; exports.useParams = useParams; exports.useResolvedPath = useResolvedPath; exports.useRoutes = useRoutes; exports.useRouteId = useRouteId; exports.useNavigation = useNavigation; exports.useRevalidator = useRevalidator; exports.useMatches = useMatches; exports.useLoaderData = useLoaderData; exports.useRouteLoaderData = useRouteLoaderData; exports.useActionData = useActionData; exports.useRouteError = useRouteError; exports.useAsyncValue = useAsyncValue; exports.useAsyncError = useAsyncError; exports.useBlocker = useBlocker; exports.useRoute = useRoute; exports.RemixErrorBoundary = RemixErrorBoundary; exports.createServerRoutes = createServerRoutes; exports.createClientRoutesWithHMRRevalidationOptOut = createClientRoutesWithHMRRevalidationOptOut; exports.noActionDefinedError = noActionDefinedError; exports.createClientRoutes = createClientRoutes; exports.shouldHydrateRouteLoader = shouldHydrateRouteLoader; exports.URL_LIMIT = URL_LIMIT; exports.getPatchRoutesOnNavigationFunction = getPatchRoutesOnNavigationFunction; exports.useFogOFWarDiscovery = useFogOFWarDiscovery; exports.getManifestPath = getManifestPath; exports.FrameworkContext = FrameworkContext; exports.usePrefetchBehavior = usePrefetchBehavior; exports.CRITICAL_CSS_DATA_ATTRIBUTE = CRITICAL_CSS_DATA_ATTRIBUTE; exports.Links = Links; exports.PrefetchPageLinks = PrefetchPageLinks; exports.Meta = Meta; exports.setIsHydrated = setIsHydrated; exports.Scripts = Scripts; exports.mergeRefs = mergeRefs; exports.mapRouteProperties = mapRouteProperties; exports.hydrationRouteProperties = hydrationRouteProperties; exports.createMemoryRouter = createMemoryRouter; exports.RouterProvider = RouterProvider; exports.DataRoutes = DataRoutes2; exports.MemoryRouter = MemoryRouter; exports.Navigate = Navigate; exports.Outlet = Outlet; exports.Route = Route; exports.Router = Router; exports.Routes = Routes; exports.Await = Await; exports.createRoutesFromChildren = createRoutesFromChildren; exports.createRoutesFromElements = createRoutesFromElements; exports.renderMatches = renderMatches; exports.WithComponentProps = WithComponentProps; exports.withComponentProps = withComponentProps; exports.WithHydrateFallbackProps = WithHydrateFallbackProps; exports.withHydrateFallbackProps = withHydrateFallbackProps; exports.WithErrorBoundaryProps = WithErrorBoundaryProps; exports.withErrorBoundaryProps = withErrorBoundaryProps;
10228
+
10229
+ exports.Action = Action; exports.createMemoryHistory = createMemoryHistory; exports.createBrowserHistory = createBrowserHistory; exports.createHashHistory = createHashHistory; exports.invariant = invariant; exports.warning = warning; exports.createPath = createPath; exports.parsePath = parsePath; exports.createContext = createContext; exports.RouterContextProvider = RouterContextProvider; exports.convertRoutesToDataRoutes = convertRoutesToDataRoutes; exports.matchRoutes = matchRoutes; exports.matchRoutesImpl = matchRoutesImpl; exports.generatePath = generatePath; exports.matchPath = matchPath; exports.stripBasename = stripBasename; exports.resolvePath = resolvePath; exports.resolveTo = resolveTo; exports.joinPaths = joinPaths; exports.data = data; exports.redirect = redirect; exports.redirectDocument = redirectDocument; exports.replace = replace; exports.ErrorResponseImpl = ErrorResponseImpl; exports.isRouteErrorResponse = isRouteErrorResponse; exports.parseToInfo = parseToInfo; exports.escapeHtml = escapeHtml; exports.encode = encode; exports.instrumentHandler = instrumentHandler; exports.IDLE_NAVIGATION = IDLE_NAVIGATION; exports.IDLE_FETCHER = IDLE_FETCHER; exports.IDLE_BLOCKER = IDLE_BLOCKER; exports.createRouter = createRouter; exports.createStaticHandler = createStaticHandler; exports.getStaticContextFromError = getStaticContextFromError; exports.invalidProtocols = invalidProtocols; exports.isDataWithResponseInit = isDataWithResponseInit; exports.isResponse = isResponse; exports.isRedirectStatusCode = isRedirectStatusCode; exports.isRedirectResponse = isRedirectResponse; exports.isMutationMethod = isMutationMethod; exports.createRequestInit = createRequestInit; exports.SingleFetchRedirectSymbol = SingleFetchRedirectSymbol; exports.SINGLE_FETCH_REDIRECT_STATUS = SINGLE_FETCH_REDIRECT_STATUS; exports.NO_BODY_STATUS_CODES = NO_BODY_STATUS_CODES; exports.StreamTransfer = StreamTransfer; exports.getTurboStreamSingleFetchDataStrategy = getTurboStreamSingleFetchDataStrategy; exports.getSingleFetchDataStrategyImpl = getSingleFetchDataStrategyImpl; exports.stripIndexParam = stripIndexParam; exports.singleFetchUrl = singleFetchUrl; exports.decodeViaTurboStream = decodeViaTurboStream; exports.DataRouterContext = DataRouterContext; exports.DataRouterStateContext = DataRouterStateContext; exports.RSCRouterContext = RSCRouterContext; exports.ViewTransitionContext = ViewTransitionContext; exports.FetchersContext = FetchersContext; exports.AwaitContextProvider = AwaitContextProvider; exports.NavigationContext = NavigationContext; exports.LocationContext = LocationContext; exports.RouteContext = RouteContext; exports.ENABLE_DEV_WARNINGS = ENABLE_DEV_WARNINGS; exports.warnOnce = warnOnce; exports.decodeRedirectErrorDigest = decodeRedirectErrorDigest; exports.decodeRouteErrorResponseDigest = decodeRouteErrorResponseDigest; exports.useHref = useHref; exports.useInRouterContext = useInRouterContext; exports.useLocation = useLocation; exports.useNavigationType = useNavigationType; exports.useMatch = useMatch; exports.useNavigate = useNavigate; exports.useOutletContext = useOutletContext; exports.useOutlet = useOutlet; exports.useParams = useParams; exports.useResolvedPath = useResolvedPath; exports.useRoutes = useRoutes; exports.useRouteId = useRouteId; exports.useNavigation = useNavigation; exports.useRevalidator = useRevalidator; exports.useMatches = useMatches; exports.useLoaderData = useLoaderData; exports.useRouteLoaderData = useRouteLoaderData; exports.useActionData = useActionData; exports.useRouteError = useRouteError; exports.useAsyncValue = useAsyncValue; exports.useAsyncError = useAsyncError; exports.useBlocker = useBlocker; exports.useRoute = useRoute; exports.useRouterState = useRouterState; exports.RemixErrorBoundary = RemixErrorBoundary; exports.createServerRoutes = createServerRoutes; exports.createClientRoutesWithHMRRevalidationOptOut = createClientRoutesWithHMRRevalidationOptOut; exports.noActionDefinedError = noActionDefinedError; exports.createClientRoutes = createClientRoutes; exports.shouldHydrateRouteLoader = shouldHydrateRouteLoader; exports.URL_LIMIT = URL_LIMIT; exports.getPatchRoutesOnNavigationFunction = getPatchRoutesOnNavigationFunction; exports.useFogOFWarDiscovery = useFogOFWarDiscovery; exports.getManifestPath = getManifestPath; exports.FrameworkContext = FrameworkContext; exports.usePrefetchBehavior = usePrefetchBehavior; exports.CRITICAL_CSS_DATA_ATTRIBUTE = CRITICAL_CSS_DATA_ATTRIBUTE; exports.Links = Links; exports.PrefetchPageLinks = PrefetchPageLinks; exports.Meta = Meta; exports.setIsHydrated = setIsHydrated; exports.Scripts = Scripts; exports.mergeRefs = mergeRefs; exports.mapRouteProperties = mapRouteProperties; exports.hydrationRouteProperties = hydrationRouteProperties; exports.createMemoryRouter = createMemoryRouter; exports.RouterProvider = RouterProvider; exports.DataRoutes = DataRoutes2; exports.MemoryRouter = MemoryRouter; exports.Navigate = Navigate; exports.Outlet = Outlet; exports.Route = Route; exports.Router = Router; exports.Routes = Routes; exports.Await = Await; exports.createRoutesFromChildren = createRoutesFromChildren; exports.createRoutesFromElements = createRoutesFromElements; exports.renderMatches = renderMatches; exports.WithComponentProps = WithComponentProps; exports.withComponentProps = withComponentProps; exports.WithHydrateFallbackProps = WithHydrateFallbackProps; exports.withHydrateFallbackProps = withHydrateFallbackProps; exports.WithErrorBoundaryProps = WithErrorBoundaryProps; exports.withErrorBoundaryProps = withErrorBoundaryProps;