react-router 6.8.1-pre.0 → 6.8.2-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 +10 -3
- package/dist/index.js +25 -25
- package/dist/index.js.map +1 -1
- package/dist/main.js +1 -1
- package/dist/react-router.development.js +19 -19
- package/dist/react-router.development.js.map +1 -1
- package/dist/react-router.production.min.js +2 -2
- package/dist/react-router.production.min.js.map +1 -1
- package/dist/umd/react-router.development.js +18 -18
- package/dist/umd/react-router.development.js.map +1 -1
- package/dist/umd/react-router.production.min.js +2 -2
- package/dist/umd/react-router.production.min.js.map +1 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,12 +1,19 @@
|
|
|
1
1
|
# `react-router`
|
|
2
2
|
|
|
3
|
-
## 6.8.
|
|
3
|
+
## 6.8.2-pre.0
|
|
4
4
|
|
|
5
5
|
### Patch Changes
|
|
6
6
|
|
|
7
|
-
- Remove inaccurate console warning for POP navigations ([#10030](https://github.com/remix-run/react-router/pull/10030))
|
|
8
7
|
- Updated dependencies:
|
|
9
|
-
- `@remix-run/router@1.3.
|
|
8
|
+
- `@remix-run/router@1.3.3-pre.0`
|
|
9
|
+
|
|
10
|
+
## 6.8.1
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- Remove inaccurate console warning for POP navigations and update active blocker logic ([#10030](https://github.com/remix-run/react-router/pull/10030))
|
|
15
|
+
- Updated dependencies:
|
|
16
|
+
- `@remix-run/router@1.3.2`
|
|
10
17
|
|
|
11
18
|
## 6.8.0
|
|
12
19
|
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* React Router v6.8.
|
|
2
|
+
* React Router v6.8.2-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 {
|
|
11
|
+
import { UNSAFE_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
|
|
|
@@ -263,9 +263,9 @@ function useHref(to, _temp) {
|
|
|
263
263
|
let {
|
|
264
264
|
relative
|
|
265
265
|
} = _temp === void 0 ? {} : _temp;
|
|
266
|
-
!useInRouterContext() ? process.env.NODE_ENV !== "production" ?
|
|
266
|
+
!useInRouterContext() ? process.env.NODE_ENV !== "production" ? UNSAFE_invariant(false, // TODO: This error is probably because they somehow have 2 versions of the
|
|
267
267
|
// router loaded. We can help them understand how to avoid that.
|
|
268
|
-
"useHref() may be used only in the context of a <Router> component.") :
|
|
268
|
+
"useHref() may be used only in the context of a <Router> component.") : UNSAFE_invariant(false) : void 0;
|
|
269
269
|
let {
|
|
270
270
|
basename,
|
|
271
271
|
navigator
|
|
@@ -313,9 +313,9 @@ function useInRouterContext() {
|
|
|
313
313
|
*/
|
|
314
314
|
|
|
315
315
|
function useLocation() {
|
|
316
|
-
!useInRouterContext() ? process.env.NODE_ENV !== "production" ?
|
|
316
|
+
!useInRouterContext() ? process.env.NODE_ENV !== "production" ? UNSAFE_invariant(false, // TODO: This error is probably because they somehow have 2 versions of the
|
|
317
317
|
// router loaded. We can help them understand how to avoid that.
|
|
318
|
-
"useLocation() may be used only in the context of a <Router> component.") :
|
|
318
|
+
"useLocation() may be used only in the context of a <Router> component.") : UNSAFE_invariant(false) : void 0;
|
|
319
319
|
return React.useContext(LocationContext).location;
|
|
320
320
|
}
|
|
321
321
|
/**
|
|
@@ -337,9 +337,9 @@ function useNavigationType() {
|
|
|
337
337
|
*/
|
|
338
338
|
|
|
339
339
|
function useMatch(pattern) {
|
|
340
|
-
!useInRouterContext() ? process.env.NODE_ENV !== "production" ?
|
|
340
|
+
!useInRouterContext() ? process.env.NODE_ENV !== "production" ? UNSAFE_invariant(false, // TODO: This error is probably because they somehow have 2 versions of the
|
|
341
341
|
// router loaded. We can help them understand how to avoid that.
|
|
342
|
-
"useMatch() may be used only in the context of a <Router> component.") :
|
|
342
|
+
"useMatch() may be used only in the context of a <Router> component.") : UNSAFE_invariant(false) : void 0;
|
|
343
343
|
let {
|
|
344
344
|
pathname
|
|
345
345
|
} = useLocation();
|
|
@@ -356,9 +356,9 @@ function useMatch(pattern) {
|
|
|
356
356
|
* @see https://reactrouter.com/hooks/use-navigate
|
|
357
357
|
*/
|
|
358
358
|
function useNavigate() {
|
|
359
|
-
!useInRouterContext() ? process.env.NODE_ENV !== "production" ?
|
|
359
|
+
!useInRouterContext() ? process.env.NODE_ENV !== "production" ? UNSAFE_invariant(false, // TODO: This error is probably because they somehow have 2 versions of the
|
|
360
360
|
// router loaded. We can help them understand how to avoid that.
|
|
361
|
-
"useNavigate() may be used only in the context of a <Router> component.") :
|
|
361
|
+
"useNavigate() may be used only in the context of a <Router> component.") : UNSAFE_invariant(false) : void 0;
|
|
362
362
|
let {
|
|
363
363
|
basename,
|
|
364
364
|
navigator
|
|
@@ -471,9 +471,9 @@ function useResolvedPath(to, _temp2) {
|
|
|
471
471
|
*/
|
|
472
472
|
|
|
473
473
|
function useRoutes(routes, locationArg) {
|
|
474
|
-
!useInRouterContext() ? process.env.NODE_ENV !== "production" ?
|
|
474
|
+
!useInRouterContext() ? process.env.NODE_ENV !== "production" ? UNSAFE_invariant(false, // TODO: This error is probably because they somehow have 2 versions of the
|
|
475
475
|
// router loaded. We can help them understand how to avoid that.
|
|
476
|
-
"useRoutes() may be used only in the context of a <Router> component.") :
|
|
476
|
+
"useRoutes() may be used only in the context of a <Router> component.") : UNSAFE_invariant(false) : void 0;
|
|
477
477
|
let {
|
|
478
478
|
navigator
|
|
479
479
|
} = React.useContext(NavigationContext);
|
|
@@ -519,7 +519,7 @@ function useRoutes(routes, locationArg) {
|
|
|
519
519
|
var _parsedLocationArg$pa;
|
|
520
520
|
|
|
521
521
|
let parsedLocationArg = typeof locationArg === "string" ? parsePath(locationArg) : locationArg;
|
|
522
|
-
!(parentPathnameBase === "/" || ((_parsedLocationArg$pa = parsedLocationArg.pathname) == null ? void 0 : _parsedLocationArg$pa.startsWith(parentPathnameBase))) ? process.env.NODE_ENV !== "production" ?
|
|
522
|
+
!(parentPathnameBase === "/" || ((_parsedLocationArg$pa = parsedLocationArg.pathname) == null ? void 0 : _parsedLocationArg$pa.startsWith(parentPathnameBase))) ? process.env.NODE_ENV !== "production" ? UNSAFE_invariant(false, "When overriding the location using `<Routes location>` or `useRoutes(routes, location)`, " + "the location pathname must begin with the portion of the URL pathname that was " + ("matched by all parent routes. The current pathname base is \"" + parentPathnameBase + "\" ") + ("but pathname \"" + parsedLocationArg.pathname + "\" was given in the `location` prop.")) : UNSAFE_invariant(false) : void 0;
|
|
523
523
|
location = parsedLocationArg;
|
|
524
524
|
} else {
|
|
525
525
|
location = locationFromContext;
|
|
@@ -692,7 +692,7 @@ function _renderMatches(matches, parentMatches, dataRouterState) {
|
|
|
692
692
|
|
|
693
693
|
if (errors != null) {
|
|
694
694
|
let errorIndex = renderedMatches.findIndex(m => m.route.id && (errors == null ? void 0 : errors[m.route.id]));
|
|
695
|
-
!(errorIndex >= 0) ? process.env.NODE_ENV !== "production" ?
|
|
695
|
+
!(errorIndex >= 0) ? process.env.NODE_ENV !== "production" ? UNSAFE_invariant(false, "Could not find a matching route for the current errors: " + errors) : UNSAFE_invariant(false) : void 0;
|
|
696
696
|
renderedMatches = renderedMatches.slice(0, Math.min(renderedMatches.length, errorIndex + 1));
|
|
697
697
|
}
|
|
698
698
|
|
|
@@ -750,26 +750,26 @@ function getDataRouterConsoleError(hookName) {
|
|
|
750
750
|
|
|
751
751
|
function useDataRouterContext(hookName) {
|
|
752
752
|
let ctx = React.useContext(DataRouterContext);
|
|
753
|
-
!ctx ? process.env.NODE_ENV !== "production" ?
|
|
753
|
+
!ctx ? process.env.NODE_ENV !== "production" ? UNSAFE_invariant(false, getDataRouterConsoleError(hookName)) : UNSAFE_invariant(false) : void 0;
|
|
754
754
|
return ctx;
|
|
755
755
|
}
|
|
756
756
|
|
|
757
757
|
function useDataRouterState(hookName) {
|
|
758
758
|
let state = React.useContext(DataRouterStateContext);
|
|
759
|
-
!state ? process.env.NODE_ENV !== "production" ?
|
|
759
|
+
!state ? process.env.NODE_ENV !== "production" ? UNSAFE_invariant(false, getDataRouterConsoleError(hookName)) : UNSAFE_invariant(false) : void 0;
|
|
760
760
|
return state;
|
|
761
761
|
}
|
|
762
762
|
|
|
763
763
|
function useRouteContext(hookName) {
|
|
764
764
|
let route = React.useContext(RouteContext);
|
|
765
|
-
!route ? process.env.NODE_ENV !== "production" ?
|
|
765
|
+
!route ? process.env.NODE_ENV !== "production" ? UNSAFE_invariant(false, getDataRouterConsoleError(hookName)) : UNSAFE_invariant(false) : void 0;
|
|
766
766
|
return route;
|
|
767
767
|
}
|
|
768
768
|
|
|
769
769
|
function useCurrentRouteId(hookName) {
|
|
770
770
|
let route = useRouteContext(hookName);
|
|
771
771
|
let thisRoute = route.matches[route.matches.length - 1];
|
|
772
|
-
!thisRoute.route.id ? process.env.NODE_ENV !== "production" ?
|
|
772
|
+
!thisRoute.route.id ? process.env.NODE_ENV !== "production" ? UNSAFE_invariant(false, hookName + " can only be used on routes that contain a unique \"id\"") : UNSAFE_invariant(false) : void 0;
|
|
773
773
|
return thisRoute.route.id;
|
|
774
774
|
}
|
|
775
775
|
/**
|
|
@@ -852,7 +852,7 @@ function useRouteLoaderData(routeId) {
|
|
|
852
852
|
function useActionData() {
|
|
853
853
|
let state = useDataRouterState(DataRouterStateHook.UseActionData);
|
|
854
854
|
let route = React.useContext(RouteContext);
|
|
855
|
-
!route ? process.env.NODE_ENV !== "production" ?
|
|
855
|
+
!route ? process.env.NODE_ENV !== "production" ? UNSAFE_invariant(false, "useActionData must be used inside a RouteContext") : UNSAFE_invariant(false) : void 0;
|
|
856
856
|
return Object.values((state == null ? void 0 : state.actionData) || {})[0];
|
|
857
857
|
}
|
|
858
858
|
/**
|
|
@@ -1029,9 +1029,9 @@ function Navigate(_ref3) {
|
|
|
1029
1029
|
state,
|
|
1030
1030
|
relative
|
|
1031
1031
|
} = _ref3;
|
|
1032
|
-
!useInRouterContext() ? process.env.NODE_ENV !== "production" ?
|
|
1032
|
+
!useInRouterContext() ? process.env.NODE_ENV !== "production" ? UNSAFE_invariant(false, // TODO: This error is probably because they somehow have 2 versions of
|
|
1033
1033
|
// the router loaded. We can help them understand how to avoid that.
|
|
1034
|
-
"<Navigate> may be used only in the context of a <Router> component.") :
|
|
1034
|
+
"<Navigate> may be used only in the context of a <Router> component.") : UNSAFE_invariant(false) : void 0;
|
|
1035
1035
|
process.env.NODE_ENV !== "production" ? warning(!React.useContext(NavigationContext).static, "<Navigate> must not be used on the initial render in a <StaticRouter>. " + "This is a no-op, but you should modify your code so the <Navigate> is " + "only ever rendered in response to some user interaction or state change.") : void 0;
|
|
1036
1036
|
let dataRouterState = React.useContext(DataRouterStateContext);
|
|
1037
1037
|
let navigate = useNavigate();
|
|
@@ -1067,7 +1067,7 @@ function Outlet(props) {
|
|
|
1067
1067
|
* @see https://reactrouter.com/components/route
|
|
1068
1068
|
*/
|
|
1069
1069
|
function Route(_props) {
|
|
1070
|
-
process.env.NODE_ENV !== "production" ?
|
|
1070
|
+
process.env.NODE_ENV !== "production" ? UNSAFE_invariant(false, "A <Route> is only ever to be used as the child of <Routes> element, " + "never rendered directly. Please wrap your <Route> in a <Routes>.") : UNSAFE_invariant(false) ;
|
|
1071
1071
|
}
|
|
1072
1072
|
|
|
1073
1073
|
/**
|
|
@@ -1088,7 +1088,7 @@ function Router(_ref4) {
|
|
|
1088
1088
|
navigator,
|
|
1089
1089
|
static: staticProp = false
|
|
1090
1090
|
} = _ref4;
|
|
1091
|
-
!!useInRouterContext() ? process.env.NODE_ENV !== "production" ?
|
|
1091
|
+
!!useInRouterContext() ? process.env.NODE_ENV !== "production" ? UNSAFE_invariant(false, "You cannot render a <Router> inside another <Router>." + " You should never have more than one in your app.") : UNSAFE_invariant(false) : void 0; // Preserve trailing slashes on basename, so we can let the user control
|
|
1092
1092
|
// the enforcement of trailing slashes throughout the app
|
|
1093
1093
|
|
|
1094
1094
|
let basename = basenameProp.replace(/^\/*/, "/");
|
|
@@ -1327,8 +1327,8 @@ function createRoutesFromChildren(children, parentPath) {
|
|
|
1327
1327
|
return;
|
|
1328
1328
|
}
|
|
1329
1329
|
|
|
1330
|
-
!(element.type === Route) ? process.env.NODE_ENV !== "production" ?
|
|
1331
|
-
!(!element.props.index || !element.props.children) ? process.env.NODE_ENV !== "production" ?
|
|
1330
|
+
!(element.type === Route) ? process.env.NODE_ENV !== "production" ? UNSAFE_invariant(false, "[" + (typeof element.type === "string" ? element.type : element.type.name) + "] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>") : UNSAFE_invariant(false) : void 0;
|
|
1331
|
+
!(!element.props.index || !element.props.children) ? process.env.NODE_ENV !== "production" ? UNSAFE_invariant(false, "An index route cannot have child routes.") : UNSAFE_invariant(false) : void 0;
|
|
1332
1332
|
let treePath = [...parentPath, index];
|
|
1333
1333
|
let route = {
|
|
1334
1334
|
id: element.props.id || treePath.join("-"),
|