react-router-dom 6.23.1 → 6.24.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 +17 -0
- package/dist/dom.d.ts +29 -16
- package/dist/index.d.ts +18 -6
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/main.js +1 -1
- package/dist/react-router-dom.development.js +29 -1
- package/dist/react-router-dom.development.js.map +1 -1
- package/dist/react-router-dom.production.min.js +2 -2
- package/dist/react-router-dom.production.min.js.map +1 -1
- package/dist/server.js +4 -1
- package/dist/server.mjs +4 -1
- package/dist/umd/react-router-dom.development.js +29 -1
- package/dist/umd/react-router-dom.development.js.map +1 -1
- package/dist/umd/react-router-dom.production.min.js +2 -2
- package/dist/umd/react-router-dom.production.min.js.map +1 -1
- package/package.json +3 -3
- package/server.js +4 -1
- package/server.mjs +4 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# `react-router-dom`
|
|
2
2
|
|
|
3
|
+
## 6.24.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- Add support for Lazy Route Discovery (a.k.a. Fog of War) ([#11626](https://github.com/remix-run/react-router/pull/11626))
|
|
8
|
+
|
|
9
|
+
- RFC: <https://github.com/remix-run/react-router/discussions/11113>
|
|
10
|
+
- `unstable_patchRoutesOnMiss` docs: <https://reactrouter.com/en/main/routers/create-browser-router>
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- Fix `fetcher.submit` types - remove incorrect `navigate`/`fetcherKey`/`unstable_viewTransition` options because they are only relevant for `useSubmit` ([#11631](https://github.com/remix-run/react-router/pull/11631))
|
|
15
|
+
- Allow falsy `location.state` values passed to `<StaticRouter>` ([#11495](https://github.com/remix-run/react-router/pull/11495))
|
|
16
|
+
- Updated dependencies:
|
|
17
|
+
- `react-router@6.24.0`
|
|
18
|
+
- `@remix-run/router@1.17.0`
|
|
19
|
+
|
|
3
20
|
## 6.23.1
|
|
4
21
|
|
|
5
22
|
### Patch Changes
|
package/dist/dom.d.ts
CHANGED
|
@@ -40,7 +40,10 @@ type JsonArray = JsonValue[] | readonly JsonValue[];
|
|
|
40
40
|
type JsonPrimitive = string | number | boolean | null;
|
|
41
41
|
type JsonValue = JsonPrimitive | JsonObject | JsonArray;
|
|
42
42
|
export type SubmitTarget = HTMLFormElement | HTMLButtonElement | HTMLInputElement | FormData | URLSearchParams | JsonValue | null;
|
|
43
|
-
|
|
43
|
+
/**
|
|
44
|
+
* Submit options shared by both navigations and fetchers
|
|
45
|
+
*/
|
|
46
|
+
interface SharedSubmitOptions {
|
|
44
47
|
/**
|
|
45
48
|
* The HTTP method used to submit the form. Overrides `<form method>`.
|
|
46
49
|
* Defaults to "GET".
|
|
@@ -57,13 +60,30 @@ export interface SubmitOptions {
|
|
|
57
60
|
*/
|
|
58
61
|
encType?: FormEncType;
|
|
59
62
|
/**
|
|
60
|
-
*
|
|
63
|
+
* Determines whether the form action is relative to the route hierarchy or
|
|
64
|
+
* the pathname. Use this if you want to opt out of navigating the route
|
|
65
|
+
* hierarchy and want to instead route based on /-delimited URL segments
|
|
61
66
|
*/
|
|
62
|
-
|
|
67
|
+
relative?: RelativeRoutingType;
|
|
63
68
|
/**
|
|
64
|
-
*
|
|
69
|
+
* In browser-based environments, prevent resetting scroll after this
|
|
70
|
+
* navigation when using the <ScrollRestoration> component
|
|
65
71
|
*/
|
|
66
|
-
|
|
72
|
+
preventScrollReset?: boolean;
|
|
73
|
+
/**
|
|
74
|
+
* Enable flushSync for this submission's state updates
|
|
75
|
+
*/
|
|
76
|
+
unstable_flushSync?: boolean;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Submit options available to fetchers
|
|
80
|
+
*/
|
|
81
|
+
export interface FetcherSubmitOptions extends SharedSubmitOptions {
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Submit options available to navigations
|
|
85
|
+
*/
|
|
86
|
+
export interface SubmitOptions extends FetcherSubmitOptions {
|
|
67
87
|
/**
|
|
68
88
|
* Set `true` to replace the current entry in the browser's history stack
|
|
69
89
|
* instead of creating a new one (i.e. stay on "the same page"). Defaults
|
|
@@ -75,20 +95,13 @@ export interface SubmitOptions {
|
|
|
75
95
|
*/
|
|
76
96
|
state?: any;
|
|
77
97
|
/**
|
|
78
|
-
*
|
|
79
|
-
* the pathname. Use this if you want to opt out of navigating the route
|
|
80
|
-
* hierarchy and want to instead route based on /-delimited URL segments
|
|
81
|
-
*/
|
|
82
|
-
relative?: RelativeRoutingType;
|
|
83
|
-
/**
|
|
84
|
-
* In browser-based environments, prevent resetting scroll after this
|
|
85
|
-
* navigation when using the <ScrollRestoration> component
|
|
98
|
+
* Indicate a specific fetcherKey to use when using navigate=false
|
|
86
99
|
*/
|
|
87
|
-
|
|
100
|
+
fetcherKey?: string;
|
|
88
101
|
/**
|
|
89
|
-
*
|
|
102
|
+
* navigate=false will use a fetcher instead of a navigation
|
|
90
103
|
*/
|
|
91
|
-
|
|
104
|
+
navigate?: boolean;
|
|
92
105
|
/**
|
|
93
106
|
* Enable view transitions on this submission navigation
|
|
94
107
|
*/
|
package/dist/index.d.ts
CHANGED
|
@@ -3,14 +3,14 @@
|
|
|
3
3
|
* you'll need to update the rollup config for react-router-dom-v5-compat.
|
|
4
4
|
*/
|
|
5
5
|
import * as React from "react";
|
|
6
|
-
import type { FutureConfig, Location, NavigateOptions, RelativeRoutingType, RouteObject, RouterProviderProps, To } from "react-router";
|
|
6
|
+
import type { FutureConfig, Location, NavigateOptions, RelativeRoutingType, RouteObject, RouterProviderProps, To, unstable_PatchRoutesOnMissFunction } from "react-router";
|
|
7
7
|
import type { unstable_DataStrategyFunction, unstable_DataStrategyFunctionArgs, unstable_DataStrategyMatch, Fetcher, FormEncType, FormMethod, FutureConfig as RouterFutureConfig, GetScrollRestorationKeyFunction, History, HTMLFormMethod, HydrationState, Router as RemixRouter, V7_FormMethod, BlockerFunction } from "@remix-run/router";
|
|
8
8
|
import { UNSAFE_ErrorResponseImpl as ErrorResponseImpl } from "@remix-run/router";
|
|
9
|
-
import type { SubmitOptions, ParamKeyValuePair, URLSearchParamsInit, SubmitTarget } from "./dom";
|
|
9
|
+
import type { SubmitOptions, ParamKeyValuePair, URLSearchParamsInit, SubmitTarget, FetcherSubmitOptions } from "./dom";
|
|
10
10
|
import { createSearchParams } from "./dom";
|
|
11
11
|
export type { unstable_DataStrategyFunction, unstable_DataStrategyFunctionArgs, unstable_DataStrategyMatch, FormEncType, FormMethod, GetScrollRestorationKeyFunction, ParamKeyValuePair, SubmitOptions, URLSearchParamsInit, V7_FormMethod, };
|
|
12
12
|
export { createSearchParams, ErrorResponseImpl as UNSAFE_ErrorResponseImpl };
|
|
13
|
-
export type { ActionFunction, ActionFunctionArgs, AwaitProps, Blocker, BlockerFunction, DataRouteMatch, DataRouteObject, ErrorResponse, Fetcher, FutureConfig, Hash, IndexRouteObject, IndexRouteProps, JsonFunction, LazyRouteFunction, LayoutRouteProps, LoaderFunction, LoaderFunctionArgs, Location, MemoryRouterProps, NavigateFunction, NavigateOptions, NavigateProps, Navigation, Navigator, NonIndexRouteObject, OutletProps, Params, ParamParseKey, Path, PathMatch, Pathname, PathParam, PathPattern, PathRouteProps, RedirectFunction, RelativeRoutingType, RouteMatch, RouteObject, RouteProps, RouterProps, RouterProviderProps, RoutesProps, Search, ShouldRevalidateFunction, ShouldRevalidateFunctionArgs, To, UIMatch, unstable_HandlerResult, } from "react-router";
|
|
13
|
+
export type { ActionFunction, ActionFunctionArgs, AwaitProps, Blocker, BlockerFunction, DataRouteMatch, DataRouteObject, ErrorResponse, Fetcher, FutureConfig, Hash, IndexRouteObject, IndexRouteProps, JsonFunction, LazyRouteFunction, LayoutRouteProps, LoaderFunction, LoaderFunctionArgs, Location, MemoryRouterProps, NavigateFunction, NavigateOptions, NavigateProps, Navigation, Navigator, NonIndexRouteObject, OutletProps, Params, ParamParseKey, Path, PathMatch, Pathname, PathParam, PathPattern, PathRouteProps, RedirectFunction, RelativeRoutingType, RouteMatch, RouteObject, RouteProps, RouterProps, RouterProviderProps, RoutesProps, Search, ShouldRevalidateFunction, ShouldRevalidateFunctionArgs, To, UIMatch, unstable_HandlerResult, unstable_PatchRoutesOnMissFunction, } from "react-router";
|
|
14
14
|
export { AbortedDeferredError, Await, MemoryRouter, Navigate, NavigationType, Outlet, Route, Router, Routes, createMemoryRouter, createPath, createRoutesFromChildren, createRoutesFromElements, defer, isRouteErrorResponse, generatePath, json, matchPath, matchRoutes, parsePath, redirect, redirectDocument, renderMatches, resolvePath, useActionData, useAsyncError, useAsyncValue, useBlocker, useHref, useInRouterContext, useLoaderData, useLocation, useMatch, useMatches, useNavigate, useNavigation, useNavigationType, useOutlet, useOutletContext, useParams, useResolvedPath, useRevalidator, useRouteError, useRouteLoaderData, useRoutes, } from "react-router";
|
|
15
15
|
/** @internal */
|
|
16
16
|
export { UNSAFE_DataRouterContext, UNSAFE_DataRouterStateContext, UNSAFE_NavigationContext, UNSAFE_LocationContext, UNSAFE_RouteContext, UNSAFE_useRouteId, } from "react-router";
|
|
@@ -26,6 +26,7 @@ interface DOMRouterOpts {
|
|
|
26
26
|
future?: Partial<Omit<RouterFutureConfig, "v7_prependBasename">>;
|
|
27
27
|
hydrationData?: HydrationState;
|
|
28
28
|
unstable_dataStrategy?: unstable_DataStrategyFunction;
|
|
29
|
+
unstable_patchRoutesOnMiss?: unstable_PatchRoutesOnMissFunction;
|
|
29
30
|
window?: Window;
|
|
30
31
|
}
|
|
31
32
|
export declare function createBrowserRouter(routes: RouteObject[], opts?: DOMRouterOpts): RemixRouter;
|
|
@@ -120,7 +121,10 @@ export interface NavLinkProps extends Omit<LinkProps, "className" | "style" | "c
|
|
|
120
121
|
* A `<Link>` wrapper that knows if it's "active" or not.
|
|
121
122
|
*/
|
|
122
123
|
export declare const NavLink: React.ForwardRefExoticComponent<NavLinkProps & React.RefAttributes<HTMLAnchorElement>>;
|
|
123
|
-
|
|
124
|
+
/**
|
|
125
|
+
* Form props shared by navigations and fetchers
|
|
126
|
+
*/
|
|
127
|
+
interface SharedFormProps extends React.FormHTMLAttributes<HTMLFormElement> {
|
|
124
128
|
/**
|
|
125
129
|
* The HTTP verb to use when the form is submit. Supports "get", "post",
|
|
126
130
|
* "put", "delete", "patch".
|
|
@@ -152,7 +156,15 @@ export interface FetcherFormProps extends React.FormHTMLAttributes<HTMLFormEleme
|
|
|
152
156
|
*/
|
|
153
157
|
onSubmit?: React.FormEventHandler<HTMLFormElement>;
|
|
154
158
|
}
|
|
155
|
-
|
|
159
|
+
/**
|
|
160
|
+
* Form props available to fetchers
|
|
161
|
+
*/
|
|
162
|
+
export interface FetcherFormProps extends SharedFormProps {
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* Form props available to navigations
|
|
166
|
+
*/
|
|
167
|
+
export interface FormProps extends SharedFormProps {
|
|
156
168
|
/**
|
|
157
169
|
* Indicate a specific fetcherKey to use when using navigate=false
|
|
158
170
|
*/
|
|
@@ -242,7 +254,7 @@ export interface SubmitFunction {
|
|
|
242
254
|
* Submits a fetcher `<form>` to the server without reloading the page.
|
|
243
255
|
*/
|
|
244
256
|
export interface FetcherSubmitFunction {
|
|
245
|
-
(target: SubmitTarget, options?:
|
|
257
|
+
(target: SubmitTarget, options?: FetcherSubmitOptions): void;
|
|
246
258
|
}
|
|
247
259
|
/**
|
|
248
260
|
* Returns a function that may be used to programmatically submit a form (or
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* React Router DOM v6.
|
|
2
|
+
* React Router DOM v6.24.0
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -239,6 +239,7 @@ function createBrowserRouter(routes, opts) {
|
|
|
239
239
|
routes,
|
|
240
240
|
mapRouteProperties: UNSAFE_mapRouteProperties,
|
|
241
241
|
unstable_dataStrategy: opts == null ? void 0 : opts.unstable_dataStrategy,
|
|
242
|
+
unstable_patchRoutesOnMiss: opts == null ? void 0 : opts.unstable_patchRoutesOnMiss,
|
|
242
243
|
window: opts == null ? void 0 : opts.window
|
|
243
244
|
}).initialize();
|
|
244
245
|
}
|
|
@@ -255,6 +256,7 @@ function createHashRouter(routes, opts) {
|
|
|
255
256
|
routes,
|
|
256
257
|
mapRouteProperties: UNSAFE_mapRouteProperties,
|
|
257
258
|
unstable_dataStrategy: opts == null ? void 0 : opts.unstable_dataStrategy,
|
|
259
|
+
unstable_patchRoutesOnMiss: opts == null ? void 0 : opts.unstable_patchRoutesOnMiss,
|
|
258
260
|
window: opts == null ? void 0 : opts.window
|
|
259
261
|
}).initialize();
|
|
260
262
|
}
|