react-router 7.6.0 → 7.6.1-pre.1
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 +96 -0
- package/dist/development/dom-export.d.mts +1 -2
- package/dist/development/dom-export.js +1 -1
- package/dist/development/dom-export.mjs +23 -23
- package/dist/development/index.d.mts +3740 -260
- package/dist/development/index.d.ts +1762 -12
- package/dist/development/index.js +16 -7
- package/dist/development/index.mjs +11439 -121
- package/dist/development/internal-export.d.mts +504 -0
- package/dist/development/internal-export.d.ts +504 -0
- package/dist/development/{lib/types/route-module.js → internal-export.js} +4 -4
- package/dist/development/{lib/types/route-module.mjs → internal-export.mjs} +1 -1
- package/dist/production/dom-export.d.mts +1 -2
- package/dist/production/dom-export.js +1 -1
- package/dist/production/dom-export.mjs +23 -23
- package/dist/production/index.d.mts +3740 -260
- package/dist/production/index.d.ts +1762 -12
- package/dist/production/index.js +16 -7
- package/dist/production/index.mjs +11439 -121
- package/dist/production/internal-export.d.mts +504 -0
- package/dist/production/internal-export.d.ts +504 -0
- package/dist/production/{lib/types/route-module.js → internal-export.js} +4 -4
- package/dist/production/{lib/types/route-module.mjs → internal-export.mjs} +1 -1
- package/package.json +7 -7
- package/dist/development/chunk-D4RADZKF.mjs +0 -11556
- package/dist/development/lib/types/route-module.d.mts +0 -208
- package/dist/development/lib/types/route-module.d.ts +0 -208
- package/dist/development/lib-CCSAGgcP.d.mts +0 -1736
- package/dist/development/route-data-B9_30zbP.d.ts +0 -1749
- package/dist/development/route-data-C6QaL0wu.d.mts +0 -1749
- package/dist/production/chunk-CVXGOGHQ.mjs +0 -11556
- package/dist/production/lib/types/route-module.d.mts +0 -208
- package/dist/production/lib/types/route-module.d.ts +0 -208
- package/dist/production/lib-CCSAGgcP.d.mts +0 -1736
- package/dist/production/route-data-B9_30zbP.d.ts +0 -1749
- package/dist/production/route-data-C6QaL0wu.d.mts +0 -1749
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,101 @@
|
|
|
1
1
|
# `react-router`
|
|
2
2
|
|
|
3
|
+
## 7.6.1-pre.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [REMOVE] test changeset to force prerelease ([`d79c4fcac`](https://github.com/remix-run/react-router/commit/d79c4fcac236fd3bd5041ba706b2c52370337915))
|
|
8
|
+
|
|
9
|
+
## 7.6.1-pre.0
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- Update `Route.MetaArgs` to reflect that `data` can be potentially `undefined` ([#13563](https://github.com/remix-run/react-router/pull/13563))
|
|
14
|
+
|
|
15
|
+
This is primarily for cases where a route `loader` threw an error to it's own `ErrorBoundary`. but it also arises in the case of a 404 which renders the root `ErrorBoundary`/`meta` but the root loader did not run because not routes matched.
|
|
16
|
+
|
|
17
|
+
- Partially revert optimization added in `7.1.4` to reduce calls to `matchRoutes` because it surfaced other issues ([#13562](https://github.com/remix-run/react-router/pull/13562))
|
|
18
|
+
- Fix typegen when same route is used at multiple paths ([#13574](https://github.com/remix-run/react-router/pull/13574))
|
|
19
|
+
|
|
20
|
+
For example, `routes/route.tsx` is used at 4 different paths here:
|
|
21
|
+
|
|
22
|
+
```ts
|
|
23
|
+
import { type RouteConfig, route } from "@react-router/dev/routes";
|
|
24
|
+
export default [
|
|
25
|
+
route("base/:base", "routes/base.tsx", [
|
|
26
|
+
route("home/:home", "routes/route.tsx", { id: "home" }),
|
|
27
|
+
route("changelog/:changelog", "routes/route.tsx", { id: "changelog" }),
|
|
28
|
+
route("splat/*", "routes/route.tsx", { id: "splat" }),
|
|
29
|
+
]),
|
|
30
|
+
route("other/:other", "routes/route.tsx", { id: "other" }),
|
|
31
|
+
] satisfies RouteConfig;
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Previously, typegen would arbitrarily pick one of these paths to be the "winner" and generate types for the route module based on that path.
|
|
35
|
+
Now, typegen creates unions as necessary for alternate paths for the same route file.
|
|
36
|
+
|
|
37
|
+
- Better types for `params` ([#13543](https://github.com/remix-run/react-router/pull/13543))
|
|
38
|
+
|
|
39
|
+
For example:
|
|
40
|
+
|
|
41
|
+
```ts
|
|
42
|
+
// routes.ts
|
|
43
|
+
import { type RouteConfig, route } from "@react-router/dev/routes";
|
|
44
|
+
|
|
45
|
+
export default [
|
|
46
|
+
route("parent/:p", "routes/parent.tsx", [
|
|
47
|
+
route("route/:r", "routes/route.tsx", [
|
|
48
|
+
route("child1/:c1a/:c1b", "routes/child1.tsx"),
|
|
49
|
+
route("child2/:c2a/:c2b", "routes/child2.tsx"),
|
|
50
|
+
]),
|
|
51
|
+
]),
|
|
52
|
+
] satisfies RouteConfig;
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
Previously, `params` for `routes/route` were calculated as `{ p: string, r: string }`.
|
|
56
|
+
This incorrectly ignores params that could come from child routes.
|
|
57
|
+
If visiting `/parent/1/route/2/child1/3/4`, the actual params passed to `routes/route` will have a type of `{ p: string, r: string, c1a: string, c1b: string }`.
|
|
58
|
+
|
|
59
|
+
Now, `params` are aware of child routes and autocompletion will include child params as optionals:
|
|
60
|
+
|
|
61
|
+
```ts
|
|
62
|
+
params.|
|
|
63
|
+
// ^ cursor is here and you ask for autocompletion
|
|
64
|
+
// p: string
|
|
65
|
+
// r: string
|
|
66
|
+
// c1a?: string
|
|
67
|
+
// c1b?: string
|
|
68
|
+
// c2a?: string
|
|
69
|
+
// c2b?: string
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
You can also narrow the types for `params` as it is implemented as a normalized union of params for each page that includes `routes/route`:
|
|
73
|
+
|
|
74
|
+
```ts
|
|
75
|
+
if (typeof params.c1a === 'string') {
|
|
76
|
+
params.|
|
|
77
|
+
// ^ cursor is here and you ask for autocompletion
|
|
78
|
+
// p: string
|
|
79
|
+
// r: string
|
|
80
|
+
// c1a: string
|
|
81
|
+
// c1b: string
|
|
82
|
+
}
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
***
|
|
86
|
+
|
|
87
|
+
UNSTABLE: renamed internal `react-router/route-module` export to `react-router/internal`
|
|
88
|
+
UNSTABLE: removed `Info` export from generated `+types/*` files
|
|
89
|
+
|
|
90
|
+
- Avoid initial fetcher execution 404 error when Lazy Route Discovery is interrupted by a navigation ([#13564](https://github.com/remix-run/react-router/pull/13564))
|
|
91
|
+
- Remove hashes from files in `dist/` for easier usage with `patch-package` ([#13567](https://github.com/remix-run/react-router/pull/13567))
|
|
92
|
+
- href replaces splats `*` ([#13593](https://github.com/remix-run/react-router/pull/13593))
|
|
93
|
+
|
|
94
|
+
```ts
|
|
95
|
+
const a = href("/products/*", { "*": "/1/edit" });
|
|
96
|
+
// -> /products/1/edit
|
|
97
|
+
```
|
|
98
|
+
|
|
3
99
|
## 7.6.0
|
|
4
100
|
|
|
5
101
|
### Minor Changes
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
import { R as RouterInit } from './route-data-C6QaL0wu.mjs';
|
|
2
|
+
import { RouterProviderProps as RouterProviderProps$1, RouterInit } from 'react-router';
|
|
4
3
|
|
|
5
4
|
type RouterProviderProps = Omit<RouterProviderProps$1, "flushSync">;
|
|
6
5
|
declare function RouterProvider(props: Omit<RouterProviderProps, "flushSync">): React.JSX.Element;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* react-router v7.6.
|
|
2
|
+
* react-router v7.6.1-pre.1
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -8,34 +8,34 @@
|
|
|
8
8
|
*
|
|
9
9
|
* @license MIT
|
|
10
10
|
*/
|
|
11
|
-
import {
|
|
12
|
-
FrameworkContext,
|
|
13
|
-
RemixErrorBoundary,
|
|
14
|
-
RouterProvider,
|
|
15
|
-
createBrowserHistory,
|
|
16
|
-
createClientRoutes,
|
|
17
|
-
createClientRoutesWithHMRRevalidationOptOut,
|
|
18
|
-
createRouter,
|
|
19
|
-
decodeViaTurboStream,
|
|
20
|
-
deserializeErrors,
|
|
21
|
-
getHydrationData,
|
|
22
|
-
getPatchRoutesOnNavigationFunction,
|
|
23
|
-
getTurboStreamSingleFetchDataStrategy,
|
|
24
|
-
hydrationRouteProperties,
|
|
25
|
-
invariant,
|
|
26
|
-
mapRouteProperties,
|
|
27
|
-
useFogOFWarDiscovery
|
|
28
|
-
} from "./chunk-D4RADZKF.mjs";
|
|
29
11
|
|
|
30
12
|
// lib/dom-export/dom-router-provider.tsx
|
|
31
13
|
import * as React from "react";
|
|
32
14
|
import * as ReactDOM from "react-dom";
|
|
33
|
-
|
|
34
|
-
|
|
15
|
+
import { RouterProvider as BaseRouterProvider } from "react-router";
|
|
16
|
+
function RouterProvider(props) {
|
|
17
|
+
return /* @__PURE__ */ React.createElement(BaseRouterProvider, { flushSync: ReactDOM.flushSync, ...props });
|
|
35
18
|
}
|
|
36
19
|
|
|
37
20
|
// lib/dom-export/hydrated-router.tsx
|
|
38
21
|
import * as React2 from "react";
|
|
22
|
+
import {
|
|
23
|
+
UNSAFE_getHydrationData as getHydrationData,
|
|
24
|
+
UNSAFE_invariant as invariant,
|
|
25
|
+
UNSAFE_FrameworkContext as FrameworkContext,
|
|
26
|
+
UNSAFE_decodeViaTurboStream as decodeViaTurboStream,
|
|
27
|
+
UNSAFE_RemixErrorBoundary as RemixErrorBoundary,
|
|
28
|
+
UNSAFE_createBrowserHistory as createBrowserHistory,
|
|
29
|
+
UNSAFE_createClientRoutes as createClientRoutes,
|
|
30
|
+
UNSAFE_createRouter as createRouter,
|
|
31
|
+
UNSAFE_deserializeErrors as deserializeErrors,
|
|
32
|
+
UNSAFE_getTurboStreamSingleFetchDataStrategy as getTurboStreamSingleFetchDataStrategy,
|
|
33
|
+
UNSAFE_getPatchRoutesOnNavigationFunction as getPatchRoutesOnNavigationFunction,
|
|
34
|
+
UNSAFE_useFogOFWarDiscovery as useFogOFWarDiscovery,
|
|
35
|
+
UNSAFE_mapRouteProperties as mapRouteProperties,
|
|
36
|
+
UNSAFE_hydrationRouteProperties as hydrationRouteProperties,
|
|
37
|
+
UNSAFE_createClientRoutesWithHMRRevalidationOptOut as createClientRoutesWithHMRRevalidationOptOut
|
|
38
|
+
} from "react-router";
|
|
39
39
|
var ssrInfo = null;
|
|
40
40
|
var router = null;
|
|
41
41
|
function initSsrInfo() {
|
|
@@ -215,11 +215,11 @@ function HydratedRouter(props) {
|
|
|
215
215
|
routeDiscovery: ssrInfo.context.routeDiscovery
|
|
216
216
|
}
|
|
217
217
|
},
|
|
218
|
-
/* @__PURE__ */ React2.createElement(RemixErrorBoundary, { location }, /* @__PURE__ */ React2.createElement(
|
|
218
|
+
/* @__PURE__ */ React2.createElement(RemixErrorBoundary, { location }, /* @__PURE__ */ React2.createElement(RouterProvider, { router }))
|
|
219
219
|
), /* @__PURE__ */ React2.createElement(React2.Fragment, null))
|
|
220
220
|
);
|
|
221
221
|
}
|
|
222
222
|
export {
|
|
223
223
|
HydratedRouter,
|
|
224
|
-
|
|
224
|
+
RouterProvider
|
|
225
225
|
};
|