react-router 0.0.0-experimental-e960cf1a → 0.0.0-experimental-a0888892
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 +173 -7
- package/dist/index.d.ts +2 -2
- package/dist/index.js +46 -20
- package/dist/index.js.map +1 -1
- package/dist/lib/components.d.ts +1 -3
- package/dist/lib/context.d.ts +1 -1
- package/dist/main.js +1 -1
- package/dist/react-router.development.js +46 -20
- 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 +46 -20
- 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,10 +1,179 @@
|
|
|
1
1
|
# `react-router`
|
|
2
2
|
|
|
3
|
+
## 6.22.0
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies:
|
|
8
|
+
- `@remix-run/router@1.15.0`
|
|
9
|
+
|
|
10
|
+
## 6.21.3
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- Remove leftover `unstable_` prefix from `Blocker`/`BlockerFunction` types ([#11187](https://github.com/remix-run/react-router/pull/11187))
|
|
15
|
+
|
|
16
|
+
## 6.21.2
|
|
17
|
+
|
|
18
|
+
### Patch Changes
|
|
19
|
+
|
|
20
|
+
- Updated dependencies:
|
|
21
|
+
- `@remix-run/router@1.14.2`
|
|
22
|
+
|
|
23
|
+
## 6.21.1
|
|
24
|
+
|
|
25
|
+
### Patch Changes
|
|
26
|
+
|
|
27
|
+
- Fix bug with `route.lazy` not working correctly on initial SPA load when `v7_partialHydration` is specified ([#11121](https://github.com/remix-run/react-router/pull/11121))
|
|
28
|
+
- Updated dependencies:
|
|
29
|
+
- `@remix-run/router@1.14.1`
|
|
30
|
+
|
|
31
|
+
## 6.21.0
|
|
32
|
+
|
|
33
|
+
### Minor Changes
|
|
34
|
+
|
|
35
|
+
- Add a new `future.v7_relativeSplatPath` flag to implement a breaking bug fix to relative routing when inside a splat route. ([#11087](https://github.com/remix-run/react-router/pull/11087))
|
|
36
|
+
|
|
37
|
+
This fix was originally added in [#10983](https://github.com/remix-run/react-router/issues/10983) and was later reverted in [#11078](https://github.com/remix-run/react-router/pull/11078) because it was determined that a large number of existing applications were relying on the buggy behavior (see [#11052](https://github.com/remix-run/react-router/issues/11052))
|
|
38
|
+
|
|
39
|
+
**The Bug**
|
|
40
|
+
The buggy behavior is that without this flag, the default behavior when resolving relative paths is to _ignore_ any splat (`*`) portion of the current route path.
|
|
41
|
+
|
|
42
|
+
**The Background**
|
|
43
|
+
This decision was originally made thinking that it would make the concept of nested different sections of your apps in `<Routes>` easier if relative routing would _replace_ the current splat:
|
|
44
|
+
|
|
45
|
+
```jsx
|
|
46
|
+
<BrowserRouter>
|
|
47
|
+
<Routes>
|
|
48
|
+
<Route path="/" element={<Home />} />
|
|
49
|
+
<Route path="dashboard/*" element={<Dashboard />} />
|
|
50
|
+
</Routes>
|
|
51
|
+
</BrowserRouter>
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
Any paths like `/dashboard`, `/dashboard/team`, `/dashboard/projects` will match the `Dashboard` route. The dashboard component itself can then render nested `<Routes>`:
|
|
55
|
+
|
|
56
|
+
```jsx
|
|
57
|
+
function Dashboard() {
|
|
58
|
+
return (
|
|
59
|
+
<div>
|
|
60
|
+
<h2>Dashboard</h2>
|
|
61
|
+
<nav>
|
|
62
|
+
<Link to="/">Dashboard Home</Link>
|
|
63
|
+
<Link to="team">Team</Link>
|
|
64
|
+
<Link to="projects">Projects</Link>
|
|
65
|
+
</nav>
|
|
66
|
+
|
|
67
|
+
<Routes>
|
|
68
|
+
<Route path="/" element={<DashboardHome />} />
|
|
69
|
+
<Route path="team" element={<DashboardTeam />} />
|
|
70
|
+
<Route path="projects" element={<DashboardProjects />} />
|
|
71
|
+
</Routes>
|
|
72
|
+
</div>
|
|
73
|
+
);
|
|
74
|
+
}
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
Now, all links and route paths are relative to the router above them. This makes code splitting and compartmentalizing your app really easy. You could render the `Dashboard` as its own independent app, or embed it into your large app without making any changes to it.
|
|
78
|
+
|
|
79
|
+
**The Problem**
|
|
80
|
+
|
|
81
|
+
The problem is that this concept of ignoring part of a path breaks a lot of other assumptions in React Router - namely that `"."` always means the current location pathname for that route. When we ignore the splat portion, we start getting invalid paths when using `"."`:
|
|
82
|
+
|
|
83
|
+
```jsx
|
|
84
|
+
// If we are on URL /dashboard/team, and we want to link to /dashboard/team:
|
|
85
|
+
function DashboardTeam() {
|
|
86
|
+
// ❌ This is broken and results in <a href="/dashboard">
|
|
87
|
+
return <Link to=".">A broken link to the Current URL</Link>;
|
|
88
|
+
|
|
89
|
+
// ✅ This is fixed but super unintuitive since we're already at /dashboard/team!
|
|
90
|
+
return <Link to="./team">A broken link to the Current URL</Link>;
|
|
91
|
+
}
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
We've also introduced an issue that we can no longer move our `DashboardTeam` component around our route hierarchy easily - since it behaves differently if we're underneath a non-splat route, such as `/dashboard/:widget`. Now, our `"."` links will, properly point to ourself _inclusive of the dynamic param value_ so behavior will break from it's corresponding usage in a `/dashboard/*` route.
|
|
95
|
+
|
|
96
|
+
Even worse, consider a nested splat route configuration:
|
|
97
|
+
|
|
98
|
+
```jsx
|
|
99
|
+
<BrowserRouter>
|
|
100
|
+
<Routes>
|
|
101
|
+
<Route path="dashboard">
|
|
102
|
+
<Route path="*" element={<Dashboard />} />
|
|
103
|
+
</Route>
|
|
104
|
+
</Routes>
|
|
105
|
+
</BrowserRouter>
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
Now, a `<Link to=".">` and a `<Link to="..">` inside the `Dashboard` component go to the same place! That is definitely not correct!
|
|
109
|
+
|
|
110
|
+
Another common issue arose in Data Routers (and Remix) where any `<Form>` should post to it's own route `action` if you the user doesn't specify a form action:
|
|
111
|
+
|
|
112
|
+
```jsx
|
|
113
|
+
let router = createBrowserRouter({
|
|
114
|
+
path: "/dashboard",
|
|
115
|
+
children: [
|
|
116
|
+
{
|
|
117
|
+
path: "*",
|
|
118
|
+
action: dashboardAction,
|
|
119
|
+
Component() {
|
|
120
|
+
// ❌ This form is broken! It throws a 405 error when it submits because
|
|
121
|
+
// it tries to submit to /dashboard (without the splat value) and the parent
|
|
122
|
+
// `/dashboard` route doesn't have an action
|
|
123
|
+
return <Form method="post">...</Form>;
|
|
124
|
+
},
|
|
125
|
+
},
|
|
126
|
+
],
|
|
127
|
+
});
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
This is just a compounded issue from the above because the default location for a `Form` to submit to is itself (`"."`) - and if we ignore the splat portion, that now resolves to the parent route.
|
|
131
|
+
|
|
132
|
+
**The Solution**
|
|
133
|
+
If you are leveraging this behavior, it's recommended to enable the future flag, move your splat to it's own route, and leverage `../` for any links to "sibling" pages:
|
|
134
|
+
|
|
135
|
+
```jsx
|
|
136
|
+
<BrowserRouter>
|
|
137
|
+
<Routes>
|
|
138
|
+
<Route path="dashboard">
|
|
139
|
+
<Route index path="*" element={<Dashboard />} />
|
|
140
|
+
</Route>
|
|
141
|
+
</Routes>
|
|
142
|
+
</BrowserRouter>
|
|
143
|
+
|
|
144
|
+
function Dashboard() {
|
|
145
|
+
return (
|
|
146
|
+
<div>
|
|
147
|
+
<h2>Dashboard</h2>
|
|
148
|
+
<nav>
|
|
149
|
+
<Link to="..">Dashboard Home</Link>
|
|
150
|
+
<Link to="../team">Team</Link>
|
|
151
|
+
<Link to="../projects">Projects</Link>
|
|
152
|
+
</nav>
|
|
153
|
+
|
|
154
|
+
<Routes>
|
|
155
|
+
<Route path="/" element={<DashboardHome />} />
|
|
156
|
+
<Route path="team" element={<DashboardTeam />} />
|
|
157
|
+
<Route path="projects" element={<DashboardProjects />} />
|
|
158
|
+
</Router>
|
|
159
|
+
</div>
|
|
160
|
+
);
|
|
161
|
+
}
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
This way, `.` means "the full current pathname for my route" in all cases (including static, dynamic, and splat routes) and `..` always means "my parents pathname".
|
|
165
|
+
|
|
166
|
+
### Patch Changes
|
|
167
|
+
|
|
168
|
+
- Properly handle falsy error values in ErrorBoundary's ([#11071](https://github.com/remix-run/react-router/pull/11071))
|
|
169
|
+
- Updated dependencies:
|
|
170
|
+
- `@remix-run/router@1.14.0`
|
|
171
|
+
|
|
3
172
|
## 6.20.1
|
|
4
173
|
|
|
5
174
|
### Patch Changes
|
|
6
175
|
|
|
7
|
-
- Revert the `useResolvedPath` fix for splat routes due to a large number of applications that were relying on the buggy behavior (see https://github.com/remix-run/react-router/issues/11052#issuecomment-1836589329). We plan to re-introduce this fix behind a future flag in the next minor version. ([#11078](https://github.com/remix-run/react-router/pull/11078))
|
|
176
|
+
- Revert the `useResolvedPath` fix for splat routes due to a large number of applications that were relying on the buggy behavior (see <https://github.com/remix-run/react-router/issues/11052#issuecomment-1836589329>). We plan to re-introduce this fix behind a future flag in the next minor version. ([#11078](https://github.com/remix-run/react-router/pull/11078))
|
|
8
177
|
- Updated dependencies:
|
|
9
178
|
- `@remix-run/router@1.13.1`
|
|
10
179
|
|
|
@@ -32,6 +201,7 @@
|
|
|
32
201
|
### Patch Changes
|
|
33
202
|
|
|
34
203
|
- Fix `useActionData` so it returns proper contextual action data and not _any_ action data in the tree ([#11023](https://github.com/remix-run/react-router/pull/11023))
|
|
204
|
+
|
|
35
205
|
- Fix bug in `useResolvedPath` that would cause `useResolvedPath(".")` in a splat route to lose the splat portion of the URL path. ([#10983](https://github.com/remix-run/react-router/pull/10983))
|
|
36
206
|
|
|
37
207
|
- ⚠️ This fixes a quite long-standing bug specifically for `"."` paths inside a splat route which incorrectly dropped the splat portion of the URL. If you are relative routing via `"."` inside a splat route in your application you should double check that your logic is not relying on this buggy behavior and update accordingly.
|
|
@@ -144,7 +314,7 @@
|
|
|
144
314
|
|
|
145
315
|
## 6.12.1
|
|
146
316
|
|
|
147
|
-
> [!WARNING]
|
|
317
|
+
> \[!WARNING]
|
|
148
318
|
> Please use version `6.13.0` or later instead of `6.12.1`. This version suffers from a `webpack`/`terser` minification issue resulting in invalid minified code in your resulting production bundles which can cause issues in your application. See [#10579](https://github.com/remix-run/react-router/issues/10579) for more details.
|
|
149
319
|
|
|
150
320
|
### Patch Changes
|
|
@@ -476,7 +646,7 @@ function Comp() {
|
|
|
476
646
|
|
|
477
647
|
## 6.4.0
|
|
478
648
|
|
|
479
|
-
Whoa this is a big one! `6.4.0` brings all the data loading and mutation APIs over from Remix. Here's a quick high level overview, but it's recommended you go check out the [docs]
|
|
649
|
+
Whoa this is a big one! `6.4.0` brings all the data loading and mutation APIs over from Remix. Here's a quick high level overview, but it's recommended you go check out the [docs](https://reactrouter.com), especially the [feature overview](https://reactrouter.com/start/overview) and the [tutorial](https://reactrouter.com/start/tutorial).
|
|
480
650
|
|
|
481
651
|
**New APIs**
|
|
482
652
|
|
|
@@ -494,7 +664,3 @@ Whoa this is a big one! `6.4.0` brings all the data loading and mutation APIs ov
|
|
|
494
664
|
**Updated Dependencies**
|
|
495
665
|
|
|
496
666
|
- `@remix-run/router@1.0.0`
|
|
497
|
-
|
|
498
|
-
[rr-docs]: https://reactrouter.com
|
|
499
|
-
[rr-feature-overview]: https://reactrouter.com/start/overview
|
|
500
|
-
[rr-tutorial]: https://reactrouter.com/start/tutorial
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ActionFunction, ActionFunctionArgs, Blocker, BlockerFunction, DataStrategyFunction, ErrorResponse, Fetcher, HydrationState, InitialEntry, JsonFunction, LazyRouteFunction, LoaderFunction, LoaderFunctionArgs, Location, Navigation, ParamParseKey, Params, Path, PathMatch, PathParam, PathPattern, RedirectFunction, RelativeRoutingType, Router as RemixRouter, FutureConfig as RouterFutureConfig, ShouldRevalidateFunction, ShouldRevalidateFunctionArgs, To, UIMatch } from "@remix-run/router";
|
|
1
|
+
import type { ActionFunction, ActionFunctionArgs, Blocker, BlockerFunction, DataStrategyFunction, DataStrategyFunctionArgs, DataStrategyMatch, ErrorResponse, Fetcher, HydrationState, InitialEntry, JsonFunction, LazyRouteFunction, LoaderFunction, LoaderFunctionArgs, Location, Navigation, ParamParseKey, Params, Path, PathMatch, PathParam, PathPattern, RedirectFunction, RelativeRoutingType, Router as RemixRouter, FutureConfig as RouterFutureConfig, ShouldRevalidateFunction, ShouldRevalidateFunctionArgs, To, UIMatch } from "@remix-run/router";
|
|
2
2
|
import { AbortedDeferredError, Action as NavigationType, createPath, defer, generatePath, isRouteErrorResponse, json, matchPath, matchRoutes, parsePath, redirect, redirectDocument, resolvePath } from "@remix-run/router";
|
|
3
3
|
import type { AwaitProps, FutureConfig, IndexRouteProps, LayoutRouteProps, MemoryRouterProps, NavigateProps, OutletProps, PathRouteProps, RouteProps, RouterProps, RouterProviderProps, RoutesProps } from "./lib/components";
|
|
4
4
|
import { Await, MemoryRouter, Navigate, Outlet, Route, Router, RouterProvider, Routes, createRoutesFromChildren, renderMatches } from "./lib/components";
|
|
@@ -9,7 +9,7 @@ import { useActionData, useAsyncError, useAsyncValue, useBlocker, useHref, useIn
|
|
|
9
9
|
type Hash = string;
|
|
10
10
|
type Pathname = string;
|
|
11
11
|
type Search = string;
|
|
12
|
-
export type { ActionFunction, ActionFunctionArgs, AwaitProps, DataRouteMatch, DataRouteObject, ErrorResponse, Fetcher, FutureConfig, Hash, IndexRouteObject, IndexRouteProps, JsonFunction, LayoutRouteProps, LazyRouteFunction, LoaderFunction, LoaderFunctionArgs, Location, MemoryRouterProps, NavigateFunction, NavigateOptions, NavigateProps, Navigation, Navigator, NonIndexRouteObject, OutletProps, ParamParseKey, Params, Path, PathMatch, PathParam, PathPattern, PathRouteProps, Pathname, RedirectFunction, RelativeRoutingType, RouteMatch, RouteObject, RouteProps, RouterProps, RouterProviderProps, RoutesProps, Search, ShouldRevalidateFunction, ShouldRevalidateFunctionArgs, To, UIMatch, Blocker
|
|
12
|
+
export type { ActionFunction, ActionFunctionArgs, AwaitProps, DataRouteMatch, DataRouteObject, DataStrategyFunction, DataStrategyFunctionArgs, DataStrategyMatch, ErrorResponse, Fetcher, FutureConfig, Hash, IndexRouteObject, IndexRouteProps, JsonFunction, LayoutRouteProps, LazyRouteFunction, LoaderFunction, LoaderFunctionArgs, Location, MemoryRouterProps, NavigateFunction, NavigateOptions, NavigateProps, Navigation, Navigator, NonIndexRouteObject, OutletProps, ParamParseKey, Params, Path, PathMatch, PathParam, PathPattern, PathRouteProps, Pathname, RedirectFunction, RelativeRoutingType, RouteMatch, RouteObject, RouteProps, RouterProps, RouterProviderProps, RoutesProps, Search, ShouldRevalidateFunction, ShouldRevalidateFunctionArgs, To, UIMatch, Blocker, BlockerFunction, };
|
|
13
13
|
export { AbortedDeferredError, Await, MemoryRouter, Navigate, NavigationType, Outlet, Route, Router, RouterProvider, Routes, createPath, createRoutesFromChildren, createRoutesFromChildren as createRoutesFromElements, defer, generatePath, isRouteErrorResponse, json, matchPath, matchRoutes, parsePath, redirect, redirectDocument, renderMatches, resolvePath, useBlocker, useActionData, useAsyncError, useAsyncValue, useHref, useInRouterContext, useLoaderData, useLocation, useMatch, useMatches, useNavigate, useNavigation, useNavigationType, useOutlet, useOutletContext, useParams, useResolvedPath, useRevalidator, useRouteError, useRouteLoaderData, useRoutes, };
|
|
14
14
|
declare function mapRouteProperties(route: RouteObject): Partial<RouteObject> & {
|
|
15
15
|
hasErrorBoundary: boolean;
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* React Router v0.0.0-experimental-
|
|
2
|
+
* React Router v0.0.0-experimental-a0888892
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -372,13 +372,32 @@ function useRoutesImpl(routes, locationArg, dataRouterState, future) {
|
|
|
372
372
|
location = locationFromContext;
|
|
373
373
|
}
|
|
374
374
|
let pathname = location.pathname || "/";
|
|
375
|
-
let remainingPathname =
|
|
375
|
+
let remainingPathname = pathname;
|
|
376
|
+
if (parentPathnameBase !== "/") {
|
|
377
|
+
// Determine the remaining pathname by removing the # of URL segments the
|
|
378
|
+
// parentPathnameBase has, instead of removing based on character count.
|
|
379
|
+
// This is because we can't guarantee that incoming/outgoing encodings/
|
|
380
|
+
// decodings will match exactly.
|
|
381
|
+
// We decode paths before matching on a per-segment basis with
|
|
382
|
+
// decodeURIComponent(), but we re-encode pathnames via `new URL()` so they
|
|
383
|
+
// match what `window.location.pathname` would reflect. Those don't 100%
|
|
384
|
+
// align when it comes to encoded URI characters such as % and &.
|
|
385
|
+
//
|
|
386
|
+
// So we may end up with:
|
|
387
|
+
// pathname: "/descendant/a%25b/match"
|
|
388
|
+
// parentPathnameBase: "/descendant/a%b"
|
|
389
|
+
//
|
|
390
|
+
// And the direct substring removal approach won't work :/
|
|
391
|
+
let parentSegments = parentPathnameBase.replace(/^\//, "").split("/");
|
|
392
|
+
let segments = pathname.replace(/^\//, "").split("/");
|
|
393
|
+
remainingPathname = "/" + segments.slice(parentSegments.length).join("/");
|
|
394
|
+
}
|
|
376
395
|
let matches = matchRoutes(routes, {
|
|
377
396
|
pathname: remainingPathname
|
|
378
397
|
});
|
|
379
398
|
if (process.env.NODE_ENV !== "production") {
|
|
380
399
|
process.env.NODE_ENV !== "production" ? UNSAFE_warning(parentRoute || matches != null, "No routes matched location \"" + location.pathname + location.search + location.hash + "\" ") : void 0;
|
|
381
|
-
process.env.NODE_ENV !== "production" ? UNSAFE_warning(matches == null || matches[matches.length - 1].route.element !== undefined || matches[matches.length - 1].route.Component !== undefined, "Matched leaf route at location \"" + location.pathname + location.search + location.hash + "\" " + "does not have an element or Component. This means it will render an <Outlet /> with a " + "null value by default resulting in an \"empty\" page.") : void 0;
|
|
400
|
+
process.env.NODE_ENV !== "production" ? UNSAFE_warning(matches == null || matches[matches.length - 1].route.element !== undefined || matches[matches.length - 1].route.Component !== undefined || matches[matches.length - 1].route.lazy !== undefined, "Matched leaf route at location \"" + location.pathname + location.search + location.hash + "\" " + "does not have an element or Component. This means it will render an <Outlet /> with a " + "null value by default resulting in an \"empty\" page.") : void 0;
|
|
382
401
|
}
|
|
383
402
|
let renderedMatches = _renderMatches(matches && matches.map(match => Object.assign({}, match, {
|
|
384
403
|
params: Object.assign({}, parentParams, match.params),
|
|
@@ -552,17 +571,24 @@ function _renderMatches(matches, parentMatches, dataRouterState, future) {
|
|
|
552
571
|
if (match.route.HydrateFallback || match.route.hydrateFallbackElement) {
|
|
553
572
|
fallbackIndex = i;
|
|
554
573
|
}
|
|
555
|
-
if (match.route.
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
574
|
+
if (match.route.id) {
|
|
575
|
+
let {
|
|
576
|
+
loaderData,
|
|
577
|
+
errors
|
|
578
|
+
} = dataRouterState;
|
|
579
|
+
let needsToRunLoader = match.route.loader && loaderData[match.route.id] === undefined && (!errors || errors[match.route.id] === undefined);
|
|
580
|
+
if (match.route.lazy || needsToRunLoader) {
|
|
581
|
+
// We found the first route that's not ready to render (waiting on
|
|
582
|
+
// lazy, or has a loader that hasn't run yet). Flag that we need to
|
|
583
|
+
// render a fallback and render up until the appropriate fallback
|
|
584
|
+
renderFallback = true;
|
|
585
|
+
if (fallbackIndex >= 0) {
|
|
586
|
+
renderedMatches = renderedMatches.slice(0, fallbackIndex + 1);
|
|
587
|
+
} else {
|
|
588
|
+
renderedMatches = [renderedMatches[0]];
|
|
589
|
+
}
|
|
590
|
+
break;
|
|
564
591
|
}
|
|
565
|
-
break;
|
|
566
592
|
}
|
|
567
593
|
}
|
|
568
594
|
}
|
|
@@ -940,7 +966,7 @@ function RouterProvider(_ref) {
|
|
|
940
966
|
// pick up on any render-driven redirects/navigations (useEffect/<Navigate>)
|
|
941
967
|
React.useLayoutEffect(() => router.subscribe(setState), [router, setState]);
|
|
942
968
|
React.useEffect(() => {
|
|
943
|
-
process.env.NODE_ENV !== "production" ? UNSAFE_warning(fallbackElement == null || !router.future.v7_partialHydration, "`<RouterProvider fallbackElement>` is deprecated when using `v7_partialHydration`") : void 0;
|
|
969
|
+
process.env.NODE_ENV !== "production" ? UNSAFE_warning(fallbackElement == null || !router.future.v7_partialHydration, "`<RouterProvider fallbackElement>` is deprecated when using " + "`v7_partialHydration`, use a `HydrateFallback` component instead") : void 0;
|
|
944
970
|
// Only log this once on initial mount
|
|
945
971
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
946
972
|
}, []);
|
|
@@ -965,10 +991,7 @@ function RouterProvider(_ref) {
|
|
|
965
991
|
router,
|
|
966
992
|
navigator,
|
|
967
993
|
static: false,
|
|
968
|
-
basename
|
|
969
|
-
future: {
|
|
970
|
-
v7_relativeSplatPath: router.future.v7_relativeSplatPath
|
|
971
|
-
}
|
|
994
|
+
basename
|
|
972
995
|
}), [router, navigator, basename]);
|
|
973
996
|
|
|
974
997
|
// The fragment and {null} here are important! We need them to keep React 18's
|
|
@@ -985,8 +1008,11 @@ function RouterProvider(_ref) {
|
|
|
985
1008
|
basename: basename,
|
|
986
1009
|
location: state.location,
|
|
987
1010
|
navigationType: state.historyAction,
|
|
988
|
-
navigator: navigator
|
|
989
|
-
|
|
1011
|
+
navigator: navigator,
|
|
1012
|
+
future: {
|
|
1013
|
+
v7_relativeSplatPath: router.future.v7_relativeSplatPath
|
|
1014
|
+
}
|
|
1015
|
+
}, state.initialized || router.future.v7_partialHydration ? /*#__PURE__*/React.createElement(DataRoutes, {
|
|
990
1016
|
routes: router.routes,
|
|
991
1017
|
future: router.future,
|
|
992
1018
|
state: state
|