react-router 6.4.2 → 6.4.3-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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # `react-router`
2
2
 
3
+ ## 6.4.3-pre.0
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies:
8
+ - `@remix-run/router@1.0.3-pre.0`
9
+
3
10
  ## 6.4.2
4
11
 
5
12
  ### Patch Changes
@@ -40,5 +47,5 @@ Whoa this is a big one! `6.4.0` brings all the data loading and mutation APIs ov
40
47
  - `@remix-run/router@1.0.0`
41
48
 
42
49
  [rr-docs]: https://reactrouter.com/
43
- [rr-feature-overview]: https://reactrouter.com/en/v6.4.0/start/overview
44
- [rr-tutorial]: https://reactrouter.com/en/v6.4.0/start/tutorial
50
+ [rr-feature-overview]: https://reactrouter.com/en/6.4.0/start/overview
51
+ [rr-tutorial]: https://reactrouter.com/en/6.4.0/start/tutorial
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * React Router v6.4.2
2
+ * React Router v6.4.3-pre.0
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -8,7 +8,7 @@
8
8
  *
9
9
  * @license MIT
10
10
  */
11
- import { invariant, resolveTo, joinPaths, matchPath, warning, parsePath, matchRoutes, Action, isRouteErrorResponse, createMemoryHistory, stripBasename, AbortedDeferredError, createRouter } from '@remix-run/router';
11
+ import { invariant, joinPaths, matchPath, UNSAFE_getPathContributingMatches, warning, resolveTo, parsePath, matchRoutes, Action, isRouteErrorResponse, createMemoryHistory, stripBasename, AbortedDeferredError, createRouter } from '@remix-run/router';
12
12
  export { AbortedDeferredError, Action as NavigationType, createPath, defer, generatePath, isRouteErrorResponse, json, matchPath, matchRoutes, parsePath, redirect, resolvePath } from '@remix-run/router';
13
13
  import * as React from 'react';
14
14
 
@@ -356,38 +356,12 @@ function useMatch(pattern) {
356
356
  * The interface for the navigate() function returned from useNavigate().
357
357
  */
358
358
 
359
- /**
360
- * When processing relative navigation we want to ignore ancestor routes that
361
- * do not contribute to the path, such that index/pathless layout routes don't
362
- * interfere.
363
- *
364
- * For example, when moving a route element into an index route and/or a
365
- * pathless layout route, relative link behavior contained within should stay
366
- * the same. Both of the following examples should link back to the root:
367
- *
368
- * <Route path="/">
369
- * <Route path="accounts" element={<Link to=".."}>
370
- * </Route>
371
- *
372
- * <Route path="/">
373
- * <Route path="accounts">
374
- * <Route element={<AccountsLayout />}> // <-- Does not contribute
375
- * <Route index element={<Link to=".."} /> // <-- Does not contribute
376
- * </Route
377
- * </Route>
378
- * </Route>
379
- */
380
- function getPathContributingMatches(matches) {
381
- return matches.filter((match, index) => index === 0 || !match.route.index && match.pathnameBase !== matches[index - 1].pathnameBase);
382
- }
383
359
  /**
384
360
  * Returns an imperative method for changing the location. Used by <Link>s, but
385
361
  * may also be used by other elements to change the location.
386
362
  *
387
363
  * @see https://reactrouter.com/docs/en/v6/hooks/use-navigate
388
364
  */
389
-
390
-
391
365
  function useNavigate() {
392
366
  !useInRouterContext() ? process.env.NODE_ENV !== "production" ? invariant(false, // TODO: This error is probably because they somehow have 2 versions of the
393
367
  // router loaded. We can help them understand how to avoid that.
@@ -402,7 +376,7 @@ function useNavigate() {
402
376
  let {
403
377
  pathname: locationPathname
404
378
  } = useLocation();
405
- let routePathnamesJson = JSON.stringify(getPathContributingMatches(matches).map(match => match.pathnameBase));
379
+ let routePathnamesJson = JSON.stringify(UNSAFE_getPathContributingMatches(matches).map(match => match.pathnameBase));
406
380
  let activeRef = React.useRef(false);
407
381
  React.useEffect(() => {
408
382
  activeRef.current = true;
@@ -491,7 +465,7 @@ function useResolvedPath(to, _temp2) {
491
465
  let {
492
466
  pathname: locationPathname
493
467
  } = useLocation();
494
- let routePathnamesJson = JSON.stringify(getPathContributingMatches(matches).map(match => match.pathnameBase));
468
+ let routePathnamesJson = JSON.stringify(UNSAFE_getPathContributingMatches(matches).map(match => match.pathnameBase));
495
469
  return React.useMemo(() => resolveTo(to, JSON.parse(routePathnamesJson), locationPathname, relative === "path"), [to, routePathnamesJson, locationPathname, relative]);
496
470
  }
497
471
  /**