react-router 7.6.0 → 7.6.1-pre.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. package/CHANGELOG.md +90 -0
  2. package/dist/development/dom-export.d.mts +1 -2
  3. package/dist/development/dom-export.js +1 -1
  4. package/dist/development/dom-export.mjs +23 -23
  5. package/dist/development/index.d.mts +3740 -260
  6. package/dist/development/index.d.ts +1762 -12
  7. package/dist/development/index.js +16 -7
  8. package/dist/development/index.mjs +11439 -121
  9. package/dist/development/internal-export.d.mts +504 -0
  10. package/dist/development/internal-export.d.ts +504 -0
  11. package/dist/development/{lib/types/route-module.js → internal-export.js} +4 -4
  12. package/dist/development/{lib/types/route-module.mjs → internal-export.mjs} +1 -1
  13. package/dist/production/dom-export.d.mts +1 -2
  14. package/dist/production/dom-export.js +1 -1
  15. package/dist/production/dom-export.mjs +23 -23
  16. package/dist/production/index.d.mts +3740 -260
  17. package/dist/production/index.d.ts +1762 -12
  18. package/dist/production/index.js +16 -7
  19. package/dist/production/index.mjs +11439 -121
  20. package/dist/production/internal-export.d.mts +504 -0
  21. package/dist/production/internal-export.d.ts +504 -0
  22. package/dist/production/{lib/types/route-module.js → internal-export.js} +4 -4
  23. package/dist/production/{lib/types/route-module.mjs → internal-export.mjs} +1 -1
  24. package/package.json +7 -7
  25. package/dist/development/chunk-D4RADZKF.mjs +0 -11556
  26. package/dist/development/lib/types/route-module.d.mts +0 -208
  27. package/dist/development/lib/types/route-module.d.ts +0 -208
  28. package/dist/development/lib-CCSAGgcP.d.mts +0 -1736
  29. package/dist/development/route-data-B9_30zbP.d.ts +0 -1749
  30. package/dist/development/route-data-C6QaL0wu.d.mts +0 -1749
  31. package/dist/production/chunk-CVXGOGHQ.mjs +0 -11556
  32. package/dist/production/lib/types/route-module.d.mts +0 -208
  33. package/dist/production/lib/types/route-module.d.ts +0 -208
  34. package/dist/production/lib-CCSAGgcP.d.mts +0 -1736
  35. package/dist/production/route-data-B9_30zbP.d.ts +0 -1749
  36. package/dist/production/route-data-C6QaL0wu.d.mts +0 -1749
@@ -1,5 +1,5 @@
1
1
  /**
2
- * react-router v7.6.0
2
+ * react-router v7.6.1-pre.0
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -1830,6 +1830,7 @@ function createRouter(init) {
1830
1830
  fetchRedirectIds,
1831
1831
  routesToUse,
1832
1832
  basename,
1833
+ init.patchRoutesOnNavigation != null,
1833
1834
  pendingActionResult
1834
1835
  );
1835
1836
  pendingNavigationLoadId = ++incrementingLoadId;
@@ -2159,6 +2160,7 @@ function createRouter(init) {
2159
2160
  fetchRedirectIds,
2160
2161
  routesToUse,
2161
2162
  basename,
2163
+ init.patchRoutesOnNavigation != null,
2162
2164
  [match.route.id, actionResult]
2163
2165
  );
2164
2166
  revalidatingFetchers.filter((rf) => rf.key !== key).forEach((rf) => {
@@ -3577,7 +3579,7 @@ function normalizeNavigateOptions(isFetcher, path, opts) {
3577
3579
  parsedPath.search = `?${searchParams}`;
3578
3580
  return { path: createPath(parsedPath), submission };
3579
3581
  }
3580
- function getMatchesToLoad(request, scopedContext, mapRouteProperties2, manifest, history, state, matches, submission, location, lazyRoutePropertiesToSkip, initialHydration, isRevalidationRequired, cancelledFetcherLoads, fetchersQueuedForDeletion, fetchLoadMatches, fetchRedirectIds, routesToUse, basename, pendingActionResult) {
3582
+ function getMatchesToLoad(request, scopedContext, mapRouteProperties2, manifest, history, state, matches, submission, location, lazyRoutePropertiesToSkip, initialHydration, isRevalidationRequired, cancelledFetcherLoads, fetchersQueuedForDeletion, fetchLoadMatches, fetchRedirectIds, routesToUse, basename, hasPatchRoutesOnNavigation, pendingActionResult) {
3581
3583
  let actionResult = pendingActionResult ? isErrorResult(pendingActionResult[1]) ? pendingActionResult[1].error : pendingActionResult[1].data : void 0;
3582
3584
  let currentUrl = history.createURL(state.location);
3583
3585
  let nextUrl = history.createURL(location);
@@ -3655,8 +3657,13 @@ function getMatchesToLoad(request, scopedContext, mapRouteProperties2, manifest,
3655
3657
  if (initialHydration || !matches.some((m) => m.route.id === f.routeId) || fetchersQueuedForDeletion.has(key)) {
3656
3658
  return;
3657
3659
  }
3660
+ let fetcher = state.fetchers.get(key);
3661
+ let isMidInitialLoad = fetcher && fetcher.state !== "idle" && fetcher.data === void 0;
3658
3662
  let fetcherMatches = matchRoutes(routesToUse, f.path, basename);
3659
3663
  if (!fetcherMatches) {
3664
+ if (hasPatchRoutesOnNavigation && isMidInitialLoad) {
3665
+ return;
3666
+ }
3660
3667
  revalidatingFetchers.push({
3661
3668
  key,
3662
3669
  routeId: f.routeId,
@@ -3671,7 +3678,6 @@ function getMatchesToLoad(request, scopedContext, mapRouteProperties2, manifest,
3671
3678
  if (fetchRedirectIds.has(key)) {
3672
3679
  return;
3673
3680
  }
3674
- let fetcher = state.fetchers.get(key);
3675
3681
  let fetcherMatch = getTargetMatch(fetcherMatches, f.path);
3676
3682
  let fetchController = new AbortController();
3677
3683
  let fetchRequest = createClientSideRequest(
@@ -3691,7 +3697,7 @@ function getMatchesToLoad(request, scopedContext, mapRouteProperties2, manifest,
3691
3697
  lazyRoutePropertiesToSkip,
3692
3698
  scopedContext
3693
3699
  );
3694
- } else if (fetcher && fetcher.state !== "idle" && fetcher.data === void 0) {
3700
+ } else if (isMidInitialLoad) {
3695
3701
  if (isRevalidationRequired) {
3696
3702
  fetcherDsMatches = getTargetedDataStrategyMatches(
3697
3703
  mapRouteProperties2,
@@ -5098,7 +5104,7 @@ function useRoutesImpl(routes, locationArg, dataRouterState, future) {
5098
5104
  // router loaded. We can help them understand how to avoid that.
5099
5105
  `useRoutes() may be used only in the context of a <Router> component.`
5100
5106
  );
5101
- let { navigator, static: isStatic } = React2.useContext(NavigationContext);
5107
+ let { navigator } = React2.useContext(NavigationContext);
5102
5108
  let { matches: parentMatches } = React2.useContext(RouteContext);
5103
5109
  let routeMatch = parentMatches[parentMatches.length - 1];
5104
5110
  let parentParams = routeMatch ? routeMatch.params : {};
@@ -5134,7 +5140,7 @@ Please change the parent <Route path="${parentPath}"> to <Route path="${parentPa
5134
5140
  let segments = pathname.replace(/^\//, "").split("/");
5135
5141
  remainingPathname = "/" + segments.slice(parentSegments.length).join("/");
5136
5142
  }
5137
- let matches = !isStatic && dataRouterState && dataRouterState.matches && dataRouterState.matches.length > 0 ? dataRouterState.matches : matchRoutes(routes, { pathname: remainingPathname });
5143
+ let matches = matchRoutes(routes, { pathname: remainingPathname });
5138
5144
  if (ENABLE_DEV_WARNINGS) {
5139
5145
  warning(
5140
5146
  parentRoute || matches != null,
@@ -8829,7 +8835,7 @@ function mergeRefs(...refs) {
8829
8835
  var isBrowser = typeof window !== "undefined" && typeof window.document !== "undefined" && typeof window.document.createElement !== "undefined";
8830
8836
  try {
8831
8837
  if (isBrowser) {
8832
- window.__reactRouterVersion = "7.6.0";
8838
+ window.__reactRouterVersion = "7.6.1-pre.0";
8833
8839
  }
8834
8840
  } catch (e) {
8835
8841
  }
@@ -11509,6 +11515,9 @@ function createMemorySessionStorage({ cookie } = {}) {
11509
11515
  function href(path, ...args) {
11510
11516
  let params = args[0];
11511
11517
  return path.split("/").map((segment) => {
11518
+ if (segment === "*") {
11519
+ return params ? params["*"] : void 0;
11520
+ }
11512
11521
  const match = segment.match(/^:([\w-]+)(\?)?/);
11513
11522
  if (!match) return segment;
11514
11523
  const param = match[1];