Skip to content

Commit 12db33a

Browse files
authored
chore: Update version for release (pre) (#10174)
1 parent 634d8bf commit 12db33a

File tree

12 files changed

+313
-12
lines changed

12 files changed

+313
-12
lines changed

.changeset/component-and-error-boundary.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ const elementRoutes = createRoutesFromElements(
3333
<Route path='/' element={<Home />} errorElement={<HomeError /> } />
3434
);
3535

36-
const elementRoutes = createRoutesFromElements(
36+
const componentRoutes = createRoutesFromElements(
3737
<Route path='/' Component={Home} ErrorBoundary={HomeError} />
3838
);
3939

.changeset/pre.json

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,11 @@
88
"react-router-native": "6.8.2",
99
"@remix-run/router": "1.3.3"
1010
},
11-
"changesets": []
11+
"changesets": [
12+
"compat-data-router-exports",
13+
"component-and-error-boundary",
14+
"fix-generate-path",
15+
"improve-context-memoization",
16+
"lazy-route-modules"
17+
]
1218
}

packages/react-router-dom-v5-compat/CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
# `react-router-dom-v5-compat`
22

3+
## 6.9.0-pre.0
4+
5+
### Patch Changes
6+
7+
- Add missed data router API re-exports ([#10171](https://github.com/remix-run/react-router/pull/10171))
8+
- Updated dependencies:
9+
10+
11+
312
## 6.8.2
413

514
### Patch Changes

packages/react-router-dom-v5-compat/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-router-dom-v5-compat",
3-
"version": "6.8.2",
3+
"version": "6.9.0-pre.0",
44
"description": "Migration path to React Router v6 from v4/5",
55
"keywords": [
66
"react",
@@ -24,7 +24,7 @@
2424
"types": "./dist/index.d.ts",
2525
"dependencies": {
2626
"history": "^5.3.0",
27-
"react-router": "6.8.2"
27+
"react-router": "6.9.0-pre.0"
2828
},
2929
"peerDependencies": {
3030
"react": ">=16.8",

packages/react-router-dom/CHANGELOG.md

Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,111 @@
11
# `react-router-dom`
22

3+
## 6.9.0-pre.0
4+
5+
### Minor Changes
6+
7+
- React Router now supports an alternative way to define your route `element` and `errorElement` fields as React Components instead of React Elements. You can instead pass a React Component to the new `Component` and `ErrorBoundary` fields if you choose. There is no functional difference between the two, so use whichever approach you prefer 😀. You shouldn't be defining both, but if you do `Component`/`ErrorBoundary` will "win". ([#10045](https://github.com/remix-run/react-router/pull/10045))
8+
9+
**Example JSON Syntax**
10+
11+
```jsx
12+
// Both of these work the same:
13+
const elementRoutes = [{
14+
path: '/',
15+
element: <Home />,
16+
errorElement: <HomeError />,
17+
}]
18+
19+
const componentRoutes = [{
20+
path: '/',
21+
Component: Home,
22+
ErrorBoundary: HomeError,
23+
}]
24+
25+
function Home() { ... }
26+
function HomeError() { ... }
27+
```
28+
29+
**Example JSX Syntax**
30+
31+
```jsx
32+
// Both of these work the same:
33+
const elementRoutes = createRoutesFromElements(
34+
<Route path='/' element={<Home />} errorElement={<HomeError /> } />
35+
);
36+
37+
const componentRoutes = createRoutesFromElements(
38+
<Route path='/' Component={Home} ErrorBoundary={HomeError} />
39+
);
40+
41+
function Home() { ... }
42+
function HomeError() { ... }
43+
```
44+
45+
- **Introducing Lazy Route Modules!** ([#10045](https://github.com/remix-run/react-router/pull/10045))
46+
47+
In order to keep your application bundles small and support code-splitting of your routes, we've introduced a new `lazy()` route property. This is an async function that resolves the non-route-matching portions of your route definition (`loader`, `action`, `element`/`Component`, `errorElement`/`ErrorBoundary`, `shouldRevalidate`, `handle`).
48+
49+
Lazy routes are resolved on initial load and during the `loading` or `submitting` phase of a navigation or fetcher call. You cannot lazily define route-matching properties (`path`, `index`, `children`) since we only execute your lazy route functions after we've matched known routes.
50+
51+
Your `lazy` functions will typically return the result of a dynamic import.
52+
53+
```jsx
54+
// In this example, we assume most folks land on the homepage so we include that
55+
// in our critical-path bundle, but then we lazily load modules for /a and /b so
56+
// they don't load until the user navigates to those routes
57+
let routes = createRoutesFromElements(
58+
<Route path="/" element={<Layout />}>
59+
<Route index element={<Home />} />
60+
<Route path="a" lazy={() => import("./a")} />
61+
<Route path="b" lazy={() => import("./b")} />
62+
</Route>
63+
);
64+
```
65+
66+
Then in your lazy route modules, export the properties you want defined for the route:
67+
68+
```jsx
69+
export async function loader({ request }) {
70+
let data = await fetchData(request);
71+
return json(data);
72+
}
73+
74+
// Export a `Component` directly instead of needing to create a React Element from it
75+
export function Component() {
76+
let data = useLoaderData();
77+
78+
return (
79+
<>
80+
<h1>You made it!</h1>
81+
<p>{data}</p>
82+
</>
83+
);
84+
}
85+
86+
// Export an `ErrorBoundary` directly instead of needing to create a React Element from it
87+
export function ErrorBoundary() {
88+
let error = useRouteError();
89+
return isRouteErrorResponse(error) ? (
90+
<h1>
91+
{error.status} {error.statusText}
92+
</h1>
93+
) : (
94+
<h1>{error.message || error}</h1>
95+
);
96+
}
97+
```
98+
99+
An example of this in action can be found in the [`examples/lazy-loading-router-provider`](https://github.com/remix-run/react-router/tree/main/examples/lazy-loading-router-provider) directory of the repository.
100+
101+
🙌 Huge thanks to @rossipedia for the [Initial Proposal](https://github.com/remix-run/react-router/discussions/9826) and [POC Implementation](https://github.com/remix-run/react-router/pull/9830).
102+
103+
### Patch Changes
104+
105+
- Updated dependencies:
106+
107+
- `@remix-run/[email protected]`
108+
3109
## 6.8.2
4110

5111
### Patch Changes

packages/react-router-dom/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-router-dom",
3-
"version": "6.8.2",
3+
"version": "6.9.0-pre.0",
44
"description": "Declarative routing for React web applications",
55
"keywords": [
66
"react",
@@ -23,8 +23,8 @@
2323
"module": "./dist/index.js",
2424
"types": "./dist/index.d.ts",
2525
"dependencies": {
26-
"@remix-run/router": "1.3.3",
27-
"react-router": "6.8.2"
26+
"@remix-run/router": "1.4.0-pre.0",
27+
"react-router": "6.9.0-pre.0"
2828
},
2929
"devDependencies": {
3030
"react": "^18.2.0",

packages/react-router-native/CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
# `react-router-native`
22

3+
## 6.9.0-pre.0
4+
5+
### Patch Changes
6+
7+
- Updated dependencies:
8+
9+
310
## 6.8.2
411

512
### Patch Changes

packages/react-router-native/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-router-native",
3-
"version": "6.8.2",
3+
"version": "6.9.0-pre.0",
44
"description": "Declarative routing for React Native applications",
55
"keywords": [
66
"react",
@@ -22,7 +22,7 @@
2222
"types": "./dist/index.d.ts",
2323
"dependencies": {
2424
"@ungap/url-search-params": "^0.1.4",
25-
"react-router": "6.8.2"
25+
"react-router": "6.9.0-pre.0"
2626
},
2727
"devDependencies": {
2828
"react": "^18.2.0",

packages/react-router/CHANGELOG.md

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,112 @@
11
# `react-router`
22

3+
## 6.9.0-pre.0
4+
5+
### Minor Changes
6+
7+
- React Router now supports an alternative way to define your route `element` and `errorElement` fields as React Components instead of React Elements. You can instead pass a React Component to the new `Component` and `ErrorBoundary` fields if you choose. There is no functional difference between the two, so use whichever approach you prefer 😀. You shouldn't be defining both, but if you do `Component`/`ErrorBoundary` will "win". ([#10045](https://github.com/remix-run/react-router/pull/10045))
8+
9+
**Example JSON Syntax**
10+
11+
```jsx
12+
// Both of these work the same:
13+
const elementRoutes = [{
14+
path: '/',
15+
element: <Home />,
16+
errorElement: <HomeError />,
17+
}]
18+
19+
const componentRoutes = [{
20+
path: '/',
21+
Component: Home,
22+
ErrorBoundary: HomeError,
23+
}]
24+
25+
function Home() { ... }
26+
function HomeError() { ... }
27+
```
28+
29+
**Example JSX Syntax**
30+
31+
```jsx
32+
// Both of these work the same:
33+
const elementRoutes = createRoutesFromElements(
34+
<Route path='/' element={<Home />} errorElement={<HomeError /> } />
35+
);
36+
37+
const componentRoutes = createRoutesFromElements(
38+
<Route path='/' Component={Home} ErrorBoundary={HomeError} />
39+
);
40+
41+
function Home() { ... }
42+
function HomeError() { ... }
43+
```
44+
45+
- **Introducing Lazy Route Modules!** ([#10045](https://github.com/remix-run/react-router/pull/10045))
46+
47+
In order to keep your application bundles small and support code-splitting of your routes, we've introduced a new `lazy()` route property. This is an async function that resolves the non-route-matching portions of your route definition (`loader`, `action`, `element`/`Component`, `errorElement`/`ErrorBoundary`, `shouldRevalidate`, `handle`).
48+
49+
Lazy routes are resolved on initial load and during the `loading` or `submitting` phase of a navigation or fetcher call. You cannot lazily define route-matching properties (`path`, `index`, `children`) since we only execute your lazy route functions after we've matched known routes.
50+
51+
Your `lazy` functions will typically return the result of a dynamic import.
52+
53+
```jsx
54+
// In this example, we assume most folks land on the homepage so we include that
55+
// in our critical-path bundle, but then we lazily load modules for /a and /b so
56+
// they don't load until the user navigates to those routes
57+
let routes = createRoutesFromElements(
58+
<Route path="/" element={<Layout />}>
59+
<Route index element={<Home />} />
60+
<Route path="a" lazy={() => import("./a")} />
61+
<Route path="b" lazy={() => import("./b")} />
62+
</Route>
63+
);
64+
```
65+
66+
Then in your lazy route modules, export the properties you want defined for the route:
67+
68+
```jsx
69+
export async function loader({ request }) {
70+
let data = await fetchData(request);
71+
return json(data);
72+
}
73+
74+
// Export a `Component` directly instead of needing to create a React Element from it
75+
export function Component() {
76+
let data = useLoaderData();
77+
78+
return (
79+
<>
80+
<h1>You made it!</h1>
81+
<p>{data}</p>
82+
</>
83+
);
84+
}
85+
86+
// Export an `ErrorBoundary` directly instead of needing to create a React Element from it
87+
export function ErrorBoundary() {
88+
let error = useRouteError();
89+
return isRouteErrorResponse(error) ? (
90+
<h1>
91+
{error.status} {error.statusText}
92+
</h1>
93+
) : (
94+
<h1>{error.message || error}</h1>
95+
);
96+
}
97+
```
98+
99+
An example of this in action can be found in the [`examples/lazy-loading-router-provider`](https://github.com/remix-run/react-router/tree/main/examples/lazy-loading-router-provider) directory of the repository.
100+
101+
🙌 Huge thanks to @rossipedia for the [Initial Proposal](https://github.com/remix-run/react-router/discussions/9826) and [POC Implementation](https://github.com/remix-run/react-router/pull/9830).
102+
103+
### Patch Changes
104+
105+
- Fix `generatePath` incorrectly applying parameters in some cases ([`bc6fefa1`](https://github.com/remix-run/react-router/commit/bc6fefa19019ce9f5250c8b5af9b8c5d3390e9d1))
106+
- Improve memoization for context providers to avoid unnecessary re-renders ([`bc6fefa1`](https://github.com/remix-run/react-router/commit/bc6fefa19019ce9f5250c8b5af9b8c5d3390e9d1))
107+
- Updated dependencies:
108+
- `@remix-run/[email protected]`
109+
3110
## 6.8.2
4111

5112
### Patch Changes

packages/react-router/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-router",
3-
"version": "6.8.2",
3+
"version": "6.9.0-pre.0",
44
"description": "Declarative routing for React",
55
"keywords": [
66
"react",
@@ -23,7 +23,7 @@
2323
"module": "./dist/index.js",
2424
"types": "./dist/index.d.ts",
2525
"dependencies": {
26-
"@remix-run/router": "1.3.3"
26+
"@remix-run/router": "1.4.0-pre.0"
2727
},
2828
"devDependencies": {
2929
"react": "^18.2.0"

0 commit comments

Comments
 (0)