Skip to content

Commit ee5fcd5

Browse files
committed
Generate release notes
1 parent ddc2b94 commit ee5fcd5

File tree

7 files changed

+231
-78
lines changed

7 files changed

+231
-78
lines changed

.changeset/relative-splat-path.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66
"@remix-run/router": minor
77
---
88

9-
Add a new `future.v7_relativeSplatPath` flag to implenent a breaking bug fix to relative routing when inside a splat route.
9+
Add a new `future.v7_relativeSplatPath` flag to implement a breaking bug fix to relative routing when inside a splat route.
1010

11-
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/issues/110788) 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))
11+
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))
1212

1313
**The Bug**
1414
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.
@@ -52,7 +52,7 @@ Now, all links and route paths are relative to the router above them. This makes
5252

5353
**The Problem**
5454

55-
The problem is that this concept of ignoring part of a pth 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 `"."`:
55+
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 `"."`:
5656

5757
```jsx
5858
// If we are on URL /dashboard/team, and we want to link to /dashboard/team:

CHANGELOG.md

Lines changed: 213 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -13,122 +13,127 @@ We manage release notes in this file instead of the paginated Github Releases Pa
1313
<summary>Table of Contents</summary>
1414

1515
- [React Router Releases](#react-router-releases)
16-
- [v6.20.1](#v6201)
17-
- [Patch Changes](#patch-changes)
18-
- [v6.20.0](#v6200)
16+
- [v6.21.0](#v6210)
17+
- [What's Changed](#whats-changed)
18+
- [`future.v7_relativeSplatPath`](#futurev7_relativesplatpath)
1919
- [Minor Changes](#minor-changes)
20+
- [Patch Changes](#patch-changes)
21+
- [v6.20.1](#v6201)
2022
- [Patch Changes](#patch-changes-1)
21-
- [v6.19.0](#v6190)
22-
- [What's Changed](#whats-changed)
23-
- [`unstable_flushSync` API](#unstable_flushsync-api)
23+
- [v6.20.0](#v6200)
2424
- [Minor Changes](#minor-changes-1)
2525
- [Patch Changes](#patch-changes-2)
26-
- [v6.18.0](#v6180)
26+
- [v6.19.0](#v6190)
2727
- [What's Changed](#whats-changed-1)
28-
- [New Fetcher APIs](#new-fetcher-apis)
29-
- [Persistence Future Flag (`future.v7_fetcherPersist`)](#persistence-future-flag-futurev7_fetcherpersist)
28+
- [`unstable_flushSync` API](#unstable_flushsync-api)
3029
- [Minor Changes](#minor-changes-2)
3130
- [Patch Changes](#patch-changes-3)
32-
- [v6.17.0](#v6170)
31+
- [v6.18.0](#v6180)
3332
- [What's Changed](#whats-changed-2)
34-
- [View Transitions 🚀](#view-transitions-)
33+
- [New Fetcher APIs](#new-fetcher-apis)
34+
- [Persistence Future Flag (`future.v7_fetcherPersist`)](#persistence-future-flag-futurev7_fetcherpersist)
3535
- [Minor Changes](#minor-changes-3)
3636
- [Patch Changes](#patch-changes-4)
37-
- [v6.16.0](#v6160)
37+
- [v6.17.0](#v6170)
38+
- [What's Changed](#whats-changed-3)
39+
- [View Transitions 🚀](#view-transitions-)
3840
- [Minor Changes](#minor-changes-4)
3941
- [Patch Changes](#patch-changes-5)
40-
- [v6.15.0](#v6150)
42+
- [v6.16.0](#v6160)
4143
- [Minor Changes](#minor-changes-5)
4244
- [Patch Changes](#patch-changes-6)
43-
- [v6.14.2](#v6142)
45+
- [v6.15.0](#v6150)
46+
- [Minor Changes](#minor-changes-6)
4447
- [Patch Changes](#patch-changes-7)
45-
- [v6.14.1](#v6141)
48+
- [v6.14.2](#v6142)
4649
- [Patch Changes](#patch-changes-8)
47-
- [v6.14.0](#v6140)
48-
- [What's Changed](#whats-changed-3)
49-
- [JSON/Text Submissions](#jsontext-submissions)
50-
- [Minor Changes](#minor-changes-6)
50+
- [v6.14.1](#v6141)
5151
- [Patch Changes](#patch-changes-9)
52-
- [v6.13.0](#v6130)
52+
- [v6.14.0](#v6140)
5353
- [What's Changed](#whats-changed-4)
54+
- [JSON/Text Submissions](#jsontext-submissions)
5455
- [Minor Changes](#minor-changes-7)
5556
- [Patch Changes](#patch-changes-10)
56-
- [v6.12.1](#v6121)
57-
- [Patch Changes](#patch-changes-11)
58-
- [v6.12.0](#v6120)
57+
- [v6.13.0](#v6130)
5958
- [What's Changed](#whats-changed-5)
60-
- [`React.startTransition` support](#reactstarttransition-support)
6159
- [Minor Changes](#minor-changes-8)
60+
- [Patch Changes](#patch-changes-11)
61+
- [v6.12.1](#v6121)
6262
- [Patch Changes](#patch-changes-12)
63-
- [v6.11.2](#v6112)
63+
- [v6.12.0](#v6120)
64+
- [What's Changed](#whats-changed-6)
65+
- [`React.startTransition` support](#reactstarttransition-support)
66+
- [Minor Changes](#minor-changes-9)
6467
- [Patch Changes](#patch-changes-13)
65-
- [v6.11.1](#v6111)
68+
- [v6.11.2](#v6112)
6669
- [Patch Changes](#patch-changes-14)
67-
- [v6.11.0](#v6110)
68-
- [Minor Changes](#minor-changes-9)
70+
- [v6.11.1](#v6111)
6971
- [Patch Changes](#patch-changes-15)
70-
- [v6.10.0](#v6100)
71-
- [What's Changed](#whats-changed-6)
72+
- [v6.11.0](#v6110)
7273
- [Minor Changes](#minor-changes-10)
7374
- [Patch Changes](#patch-changes-16)
74-
- [v6.9.0](#v690)
75+
- [v6.10.0](#v6100)
7576
- [What's Changed](#whats-changed-7)
76-
- [`Component`/`ErrorBoundary` route properties](#componenterrorboundary-route-properties)
77-
- [Introducing Lazy Route Modules](#introducing-lazy-route-modules)
7877
- [Minor Changes](#minor-changes-11)
7978
- [Patch Changes](#patch-changes-17)
80-
- [v6.8.2](#v682)
79+
- [v6.9.0](#v690)
80+
- [What's Changed](#whats-changed-8)
81+
- [`Component`/`ErrorBoundary` route properties](#componenterrorboundary-route-properties)
82+
- [Introducing Lazy Route Modules](#introducing-lazy-route-modules)
83+
- [Minor Changes](#minor-changes-12)
8184
- [Patch Changes](#patch-changes-18)
82-
- [v6.8.1](#v681)
85+
- [v6.8.2](#v682)
8386
- [Patch Changes](#patch-changes-19)
84-
- [v6.8.0](#v680)
85-
- [Minor Changes](#minor-changes-12)
87+
- [v6.8.1](#v681)
8688
- [Patch Changes](#patch-changes-20)
87-
- [v6.7.0](#v670)
89+
- [v6.8.0](#v680)
8890
- [Minor Changes](#minor-changes-13)
8991
- [Patch Changes](#patch-changes-21)
90-
- [v6.6.2](#v662)
92+
- [v6.7.0](#v670)
93+
- [Minor Changes](#minor-changes-14)
9194
- [Patch Changes](#patch-changes-22)
92-
- [v6.6.1](#v661)
95+
- [v6.6.2](#v662)
9396
- [Patch Changes](#patch-changes-23)
94-
- [v6.6.0](#v660)
95-
- [What's Changed](#whats-changed-8)
96-
- [Minor Changes](#minor-changes-14)
97+
- [v6.6.1](#v661)
9798
- [Patch Changes](#patch-changes-24)
98-
- [v6.5.0](#v650)
99+
- [v6.6.0](#v660)
99100
- [What's Changed](#whats-changed-9)
100101
- [Minor Changes](#minor-changes-15)
101102
- [Patch Changes](#patch-changes-25)
102-
- [v6.4.5](#v645)
103+
- [v6.5.0](#v650)
104+
- [What's Changed](#whats-changed-10)
105+
- [Minor Changes](#minor-changes-16)
103106
- [Patch Changes](#patch-changes-26)
104-
- [v6.4.4](#v644)
107+
- [v6.4.5](#v645)
105108
- [Patch Changes](#patch-changes-27)
106-
- [v6.4.3](#v643)
109+
- [v6.4.4](#v644)
107110
- [Patch Changes](#patch-changes-28)
108-
- [v6.4.2](#v642)
111+
- [v6.4.3](#v643)
109112
- [Patch Changes](#patch-changes-29)
110-
- [v6.4.1](#v641)
113+
- [v6.4.2](#v642)
111114
- [Patch Changes](#patch-changes-30)
115+
- [v6.4.1](#v641)
116+
- [Patch Changes](#patch-changes-31)
112117
- [v6.4.0](#v640)
113-
- [What's Changed](#whats-changed-10)
118+
- [What's Changed](#whats-changed-11)
114119
- [Remix Data APIs](#remix-data-apis)
115-
- [Patch Changes](#patch-changes-31)
120+
- [Patch Changes](#patch-changes-32)
116121
- [v6.3.0](#v630)
117-
- [Minor Changes](#minor-changes-16)
122+
- [Minor Changes](#minor-changes-17)
118123
- [v6.2.2](#v622)
119-
- [Patch Changes](#patch-changes-32)
120-
- [v6.2.1](#v621)
121124
- [Patch Changes](#patch-changes-33)
122-
- [v6.2.0](#v620)
123-
- [Minor Changes](#minor-changes-17)
125+
- [v6.2.1](#v621)
124126
- [Patch Changes](#patch-changes-34)
125-
- [v6.1.1](#v611)
126-
- [Patch Changes](#patch-changes-35)
127-
- [v6.1.0](#v610)
127+
- [v6.2.0](#v620)
128128
- [Minor Changes](#minor-changes-18)
129+
- [Patch Changes](#patch-changes-35)
130+
- [v6.1.1](#v611)
129131
- [Patch Changes](#patch-changes-36)
130-
- [v6.0.1](#v601)
132+
- [v6.1.0](#v610)
133+
- [Minor Changes](#minor-changes-19)
131134
- [Patch Changes](#patch-changes-37)
135+
- [v6.0.1](#v601)
136+
- [Patch Changes](#patch-changes-38)
132137
- [v6.0.0](#v600)
133138

134139
</details>
@@ -152,6 +157,154 @@ To add a new release, copy from this template:
152157
153158
-->
154159

160+
## v6.21.0
161+
162+
### What's Changed
163+
164+
#### `future.v7_relativeSplatPath`
165+
166+
We fixed a splat route path-resolution bug in `6.19.0`, but later determined a large number of applications were relying on the buggy behavior, so we reverted the fix in `6.20.1` (see [#10983](https://github.com/remix-run/react-router/issues/10983), [#11052](https://github.com/remix-run/react-router/issues/11052), [#11078](https://github.com/remix-run/react-router/issues/11078).
167+
168+
The buggy behavior is that the default behavior when resolving relative paths inside a splat route would _ignore_ any splat (`*`) portion of the current route path.
169+
170+
**Background**
171+
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:
172+
173+
```jsx
174+
<BrowserRouter>
175+
<Routes>
176+
<Route path="/" element={<Home />} />
177+
<Route path="dashboard/*" element={<Dashboard />} />
178+
</Routes>
179+
</BrowserRouter>
180+
```
181+
182+
Any paths like `/dashboard`, `/dashboard/team`, `/dashboard/projects` will match the `Dashboard` route. The dashboard component itself can then render nested `<Routes>`:
183+
184+
```jsx
185+
function Dashboard() {
186+
return (
187+
<div>
188+
<h2>Dashboard</h2>
189+
<nav>
190+
<Link to="/">Dashboard Home</Link>
191+
<Link to="team">Team</Link>
192+
<Link to="projects">Projects</Link>
193+
</nav>
194+
195+
<Routes>
196+
<Route path="/" element={<DashboardHome />} />
197+
<Route path="team" element={<DashboardTeam />} />
198+
<Route path="projects" element={<DashboardProjects />} />
199+
</Routes>
200+
</div>
201+
);
202+
}
203+
```
204+
205+
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.
206+
207+
**The Problem**
208+
209+
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 `"."`:
210+
211+
```jsx
212+
// If we are on URL /dashboard/team, and we want to link to /dashboard/team:
213+
function DashboardTeam() {
214+
// ❌ This is broken and results in <a href="/dashboard">
215+
return <Link to=".">A broken link to the Current URL</Link>;
216+
217+
// ✅ This is fixed but super unintuitive since we're already at /dashboard/team!
218+
return <Link to="./team">A broken link to the Current URL</Link>;
219+
}
220+
```
221+
222+
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.
223+
224+
Furthermore, consider a nested splat route configuration:
225+
226+
```jsx
227+
<BrowserRouter>
228+
<Routes>
229+
<Route path="dashboard">
230+
<Route path="*" element={<Dashboard />} />
231+
</Route>
232+
</Routes>
233+
</BrowserRouter>
234+
```
235+
236+
Now, a `<Link to=".">` and a `<Link to="..">` inside the `Dashboard` component go to the same place! That is definitely not correct!
237+
238+
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:
239+
240+
```jsx
241+
let router = createBrowserRouter({
242+
path: "/dashboard",
243+
children: [
244+
{
245+
path: "*",
246+
action: dashboardAction,
247+
Component() {
248+
// ❌ This form is broken! It throws a 405 error when it submits because
249+
// it tries to submit to /dashboard (without the splat value) and the parent
250+
// `/dashboard` route doesn't have an action
251+
return <Form method="post">...</Form>;
252+
},
253+
},
254+
],
255+
});
256+
```
257+
258+
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.
259+
260+
**The Solution**
261+
If you are leveraging this behavior, it's recommended to enable the `future.v7_relativeSplatPath` flag, move your splat to it's own `Route`, and leverage `../` for any links to "sibling" pages:
262+
263+
```jsx
264+
<BrowserRouter>
265+
<Routes>
266+
<Route path="dashboard">
267+
<Route path="*" element={<Dashboard />} />
268+
</Route>
269+
</Routes>
270+
</BrowserRouter>
271+
272+
function Dashboard() {
273+
return (
274+
<div>
275+
<h2>Dashboard</h2>
276+
<nav>
277+
<Link to="..">Dashboard Home</Link>
278+
<Link to="../team">Team</Link>
279+
<Link to="../projects">Projects</Link>
280+
</nav>
281+
282+
<Routes>
283+
<Route path="/" element={<DashboardHome />} />
284+
<Route path="team" element={<DashboardTeam />} />
285+
<Route path="projects" element={<DashboardProjects />} />
286+
</Router>
287+
</div>
288+
);
289+
}
290+
```
291+
292+
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".
293+
294+
For more information, please see the [`useResolvedPath` docs](https://reactrouter.com/hooks/use-resolved-path#splat-paths).
295+
296+
### Minor Changes
297+
298+
- 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))
299+
300+
### Patch Changes
301+
302+
- Properly handle falsy error values in `ErrorBoundary`'s ([#11071](https://github.com/remix-run/react-router/pull/11071))
303+
- Catch and bubble errors thrown when trying to unwrap responses from `loader`/`action` functions ([#11061](https://github.com/remix-run/react-router/pull/11061))
304+
- Fix `relative="path"` issue when rendering `Link`/`NavLink` outside of matched routes ([#11062](https://github.com/remix-run/react-router/pull/11062))
305+
306+
**Full Changelog**: [`v6.X.Y...v6.X.Y`](https://github.com/remix-run/react-router/compare/[email protected]@6.X.Y)
307+
155308
## v6.20.1
156309

157310
### Patch Changes

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44

55
### Minor Changes
66

7-
- Add a new `future.v7_relativeSplatPath` flag to implenent a breaking bug fix to relative routing when inside a splat route. ([#11087](https://github.com/remix-run/react-router/pull/11087))
7+
- 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))
88

9-
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/issues/110788) 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))
9+
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))
1010

1111
**The Bug**
1212
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.
@@ -50,7 +50,7 @@
5050

5151
**The Problem**
5252

53-
The problem is that this concept of ignoring part of a pth 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 `"."`:
53+
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 `"."`:
5454

5555
```jsx
5656
// If we are on URL /dashboard/team, and we want to link to /dashboard/team:

0 commit comments

Comments
 (0)