Skip to content

Commit d75eed5

Browse files
committed
Merge branch 'release-next'
2 parents abfa786 + 13dfa13 commit d75eed5

File tree

23 files changed

+437
-138
lines changed

23 files changed

+437
-138
lines changed

CHANGELOG.md

Lines changed: 112 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -13,163 +13,168 @@ 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.24.1](#v6241)
17-
- [Patch Changes](#patch-changes)
18-
- [v6.24.0](#v6240)
16+
- [v6.25.0](#v6250)
1917
- [What's Changed](#whats-changed)
20-
- [Lazy Route Discovery (a.k.a. "Fog of War")](#lazy-route-discovery-aka-fog-of-war)
18+
- [Stabilized `v7_skipActionErrorRevalidation`](#stabilized-v7_skipactionerrorrevalidation)
2119
- [Minor Changes](#minor-changes)
20+
- [Patch Changes](#patch-changes)
21+
- [v6.24.1](#v6241)
2222
- [Patch Changes](#patch-changes-1)
23-
- [v6.23.1](#v6231)
23+
- [v6.24.0](#v6240)
24+
- [What's Changed](#whats-changed-1)
25+
- [Lazy Route Discovery (a.k.a. "Fog of War")](#lazy-route-discovery-aka-fog-of-war)
26+
- [Minor Changes](#minor-changes-1)
2427
- [Patch Changes](#patch-changes-2)
28+
- [v6.23.1](#v6231)
29+
- [Patch Changes](#patch-changes-3)
2530
- [v6.23.0](#v6230)
26-
- [What's Changed](#whats-changed-1)
31+
- [What's Changed](#whats-changed-2)
2732
- [Data Strategy (unstable)](#data-strategy-unstable)
2833
- [Skip Action Error Revalidation (unstable)](#skip-action-error-revalidation-unstable)
29-
- [Minor Changes](#minor-changes-1)
34+
- [Minor Changes](#minor-changes-2)
3035
- [v6.22.3](#v6223)
31-
- [Patch Changes](#patch-changes-3)
32-
- [v6.22.2](#v6222)
3336
- [Patch Changes](#patch-changes-4)
34-
- [v6.22.1](#v6221)
37+
- [v6.22.2](#v6222)
3538
- [Patch Changes](#patch-changes-5)
39+
- [v6.22.1](#v6221)
40+
- [Patch Changes](#patch-changes-6)
3641
- [v6.22.0](#v6220)
37-
- [What's Changed](#whats-changed-2)
42+
- [What's Changed](#whats-changed-3)
3843
- [Core Web Vitals Technology Report Flag](#core-web-vitals-technology-report-flag)
39-
- [Minor Changes](#minor-changes-2)
40-
- [Patch Changes](#patch-changes-6)
41-
- [v6.21.3](#v6213)
44+
- [Minor Changes](#minor-changes-3)
4245
- [Patch Changes](#patch-changes-7)
43-
- [v6.21.2](#v6212)
46+
- [v6.21.3](#v6213)
4447
- [Patch Changes](#patch-changes-8)
45-
- [v6.21.1](#v6211)
48+
- [v6.21.2](#v6212)
4649
- [Patch Changes](#patch-changes-9)
50+
- [v6.21.1](#v6211)
51+
- [Patch Changes](#patch-changes-10)
4752
- [v6.21.0](#v6210)
48-
- [What's Changed](#whats-changed-3)
53+
- [What's Changed](#whats-changed-4)
4954
- [`future.v7_relativeSplatPath`](#futurev7_relativesplatpath)
5055
- [Partial Hydration](#partial-hydration)
51-
- [Minor Changes](#minor-changes-3)
52-
- [Patch Changes](#patch-changes-10)
53-
- [v6.20.1](#v6201)
54-
- [Patch Changes](#patch-changes-11)
55-
- [v6.20.0](#v6200)
5656
- [Minor Changes](#minor-changes-4)
57+
- [Patch Changes](#patch-changes-11)
58+
- [v6.20.1](#v6201)
5759
- [Patch Changes](#patch-changes-12)
58-
- [v6.19.0](#v6190)
59-
- [What's Changed](#whats-changed-4)
60-
- [`unstable_flushSync` API](#unstable_flushsync-api)
60+
- [v6.20.0](#v6200)
6161
- [Minor Changes](#minor-changes-5)
6262
- [Patch Changes](#patch-changes-13)
63-
- [v6.18.0](#v6180)
63+
- [v6.19.0](#v6190)
6464
- [What's Changed](#whats-changed-5)
65-
- [New Fetcher APIs](#new-fetcher-apis)
66-
- [Persistence Future Flag (`future.v7_fetcherPersist`)](#persistence-future-flag-futurev7_fetcherpersist)
65+
- [`unstable_flushSync` API](#unstable_flushsync-api)
6766
- [Minor Changes](#minor-changes-6)
6867
- [Patch Changes](#patch-changes-14)
69-
- [v6.17.0](#v6170)
68+
- [v6.18.0](#v6180)
7069
- [What's Changed](#whats-changed-6)
71-
- [View Transitions 🚀](#view-transitions-)
70+
- [New Fetcher APIs](#new-fetcher-apis)
71+
- [Persistence Future Flag (`future.v7_fetcherPersist`)](#persistence-future-flag-futurev7_fetcherpersist)
7272
- [Minor Changes](#minor-changes-7)
7373
- [Patch Changes](#patch-changes-15)
74-
- [v6.16.0](#v6160)
74+
- [v6.17.0](#v6170)
75+
- [What's Changed](#whats-changed-7)
76+
- [View Transitions 🚀](#view-transitions-)
7577
- [Minor Changes](#minor-changes-8)
7678
- [Patch Changes](#patch-changes-16)
77-
- [v6.15.0](#v6150)
79+
- [v6.16.0](#v6160)
7880
- [Minor Changes](#minor-changes-9)
7981
- [Patch Changes](#patch-changes-17)
80-
- [v6.14.2](#v6142)
82+
- [v6.15.0](#v6150)
83+
- [Minor Changes](#minor-changes-10)
8184
- [Patch Changes](#patch-changes-18)
82-
- [v6.14.1](#v6141)
85+
- [v6.14.2](#v6142)
8386
- [Patch Changes](#patch-changes-19)
84-
- [v6.14.0](#v6140)
85-
- [What's Changed](#whats-changed-7)
86-
- [JSON/Text Submissions](#jsontext-submissions)
87-
- [Minor Changes](#minor-changes-10)
87+
- [v6.14.1](#v6141)
8888
- [Patch Changes](#patch-changes-20)
89-
- [v6.13.0](#v6130)
89+
- [v6.14.0](#v6140)
9090
- [What's Changed](#whats-changed-8)
91-
- [`future.v7_startTransition`](#futurev7_starttransition)
91+
- [JSON/Text Submissions](#jsontext-submissions)
9292
- [Minor Changes](#minor-changes-11)
9393
- [Patch Changes](#patch-changes-21)
94-
- [v6.12.1](#v6121)
95-
- [Patch Changes](#patch-changes-22)
96-
- [v6.12.0](#v6120)
94+
- [v6.13.0](#v6130)
9795
- [What's Changed](#whats-changed-9)
98-
- [`React.startTransition` support](#reactstarttransition-support)
96+
- [`future.v7_startTransition`](#futurev7_starttransition)
9997
- [Minor Changes](#minor-changes-12)
98+
- [Patch Changes](#patch-changes-22)
99+
- [v6.12.1](#v6121)
100100
- [Patch Changes](#patch-changes-23)
101-
- [v6.11.2](#v6112)
101+
- [v6.12.0](#v6120)
102+
- [What's Changed](#whats-changed-10)
103+
- [`React.startTransition` support](#reactstarttransition-support)
104+
- [Minor Changes](#minor-changes-13)
102105
- [Patch Changes](#patch-changes-24)
103-
- [v6.11.1](#v6111)
106+
- [v6.11.2](#v6112)
104107
- [Patch Changes](#patch-changes-25)
105-
- [v6.11.0](#v6110)
106-
- [Minor Changes](#minor-changes-13)
108+
- [v6.11.1](#v6111)
107109
- [Patch Changes](#patch-changes-26)
108-
- [v6.10.0](#v6100)
109-
- [What's Changed](#whats-changed-10)
110+
- [v6.11.0](#v6110)
110111
- [Minor Changes](#minor-changes-14)
111-
- [`future.v7_normalizeFormMethod`](#futurev7_normalizeformmethod)
112112
- [Patch Changes](#patch-changes-27)
113-
- [v6.9.0](#v690)
113+
- [v6.10.0](#v6100)
114114
- [What's Changed](#whats-changed-11)
115-
- [`Component`/`ErrorBoundary` route properties](#componenterrorboundary-route-properties)
116-
- [Introducing Lazy Route Modules](#introducing-lazy-route-modules)
117115
- [Minor Changes](#minor-changes-15)
116+
- [`future.v7_normalizeFormMethod`](#futurev7_normalizeformmethod)
118117
- [Patch Changes](#patch-changes-28)
119-
- [v6.8.2](#v682)
118+
- [v6.9.0](#v690)
119+
- [What's Changed](#whats-changed-12)
120+
- [`Component`/`ErrorBoundary` route properties](#componenterrorboundary-route-properties)
121+
- [Introducing Lazy Route Modules](#introducing-lazy-route-modules)
122+
- [Minor Changes](#minor-changes-16)
120123
- [Patch Changes](#patch-changes-29)
121-
- [v6.8.1](#v681)
124+
- [v6.8.2](#v682)
122125
- [Patch Changes](#patch-changes-30)
123-
- [v6.8.0](#v680)
124-
- [Minor Changes](#minor-changes-16)
126+
- [v6.8.1](#v681)
125127
- [Patch Changes](#patch-changes-31)
126-
- [v6.7.0](#v670)
128+
- [v6.8.0](#v680)
127129
- [Minor Changes](#minor-changes-17)
128130
- [Patch Changes](#patch-changes-32)
129-
- [v6.6.2](#v662)
131+
- [v6.7.0](#v670)
132+
- [Minor Changes](#minor-changes-18)
130133
- [Patch Changes](#patch-changes-33)
131-
- [v6.6.1](#v661)
134+
- [v6.6.2](#v662)
132135
- [Patch Changes](#patch-changes-34)
133-
- [v6.6.0](#v660)
134-
- [What's Changed](#whats-changed-12)
135-
- [Minor Changes](#minor-changes-18)
136+
- [v6.6.1](#v661)
136137
- [Patch Changes](#patch-changes-35)
137-
- [v6.5.0](#v650)
138+
- [v6.6.0](#v660)
138139
- [What's Changed](#whats-changed-13)
139140
- [Minor Changes](#minor-changes-19)
140141
- [Patch Changes](#patch-changes-36)
141-
- [v6.4.5](#v645)
142+
- [v6.5.0](#v650)
143+
- [What's Changed](#whats-changed-14)
144+
- [Minor Changes](#minor-changes-20)
142145
- [Patch Changes](#patch-changes-37)
143-
- [v6.4.4](#v644)
146+
- [v6.4.5](#v645)
144147
- [Patch Changes](#patch-changes-38)
145-
- [v6.4.3](#v643)
148+
- [v6.4.4](#v644)
146149
- [Patch Changes](#patch-changes-39)
147-
- [v6.4.2](#v642)
150+
- [v6.4.3](#v643)
148151
- [Patch Changes](#patch-changes-40)
149-
- [v6.4.1](#v641)
152+
- [v6.4.2](#v642)
150153
- [Patch Changes](#patch-changes-41)
154+
- [v6.4.1](#v641)
155+
- [Patch Changes](#patch-changes-42)
151156
- [v6.4.0](#v640)
152-
- [What's Changed](#whats-changed-14)
157+
- [What's Changed](#whats-changed-15)
153158
- [Remix Data APIs](#remix-data-apis)
154-
- [Patch Changes](#patch-changes-42)
159+
- [Patch Changes](#patch-changes-43)
155160
- [v6.3.0](#v630)
156-
- [Minor Changes](#minor-changes-20)
161+
- [Minor Changes](#minor-changes-21)
157162
- [v6.2.2](#v622)
158-
- [Patch Changes](#patch-changes-43)
159-
- [v6.2.1](#v621)
160163
- [Patch Changes](#patch-changes-44)
161-
- [v6.2.0](#v620)
162-
- [Minor Changes](#minor-changes-21)
164+
- [v6.2.1](#v621)
163165
- [Patch Changes](#patch-changes-45)
164-
- [v6.1.1](#v611)
165-
- [Patch Changes](#patch-changes-46)
166-
- [v6.1.0](#v610)
166+
- [v6.2.0](#v620)
167167
- [Minor Changes](#minor-changes-22)
168+
- [Patch Changes](#patch-changes-46)
169+
- [v6.1.1](#v611)
168170
- [Patch Changes](#patch-changes-47)
169-
- [v6.0.2](#v602)
171+
- [v6.1.0](#v610)
172+
- [Minor Changes](#minor-changes-23)
170173
- [Patch Changes](#patch-changes-48)
171-
- [v6.0.1](#v601)
174+
- [v6.0.2](#v602)
172175
- [Patch Changes](#patch-changes-49)
176+
- [v6.0.1](#v601)
177+
- [Patch Changes](#patch-changes-50)
173178
- [v6.0.0](#v600)
174179

175180
</details>
@@ -193,6 +198,31 @@ Date: YYYY-MM-DD
193198
**Full Changelog**: [`v6.X.Y...v6.X.Y`](https://github.com/remix-run/react-router/compare/[email protected]@6.X.Y)
194199
-->
195200

201+
## v6.25.0
202+
203+
Date: 2024-07-16
204+
205+
### What's Changed
206+
207+
#### Stabilized `v7_skipActionErrorRevalidation`
208+
209+
This release stabilizes the `future.unstable_skipActionErrorRevalidation` flag into [`future.v7_skipActionErrorRevalidation`](https://reactrouter.com/upgrading/future#v7_skipactionstatusrevalidation) in preparation for the upcoming React Router v7 release.
210+
211+
- When this flag is enabled, actions that return/throw a `4xx/5xx` `Response` will not trigger a revalidation by default
212+
- This also stabilizes `shouldRevalidate`'s `unstable_actionStatus` parameter to `actionStatus`
213+
214+
### Minor Changes
215+
216+
- Stabilize `future.unstable_skipActionErrorRevalidation` as `future.v7_skipActionErrorRevalidation` ([#11769](https://github.com/remix-run/react-router/pull/11769))
217+
218+
### Patch Changes
219+
220+
- Fix regression and properly decode paths inside `useMatch` so matches/params reflect decoded params ([#11789](https://github.com/remix-run/react-router/pull/11789))
221+
- Fix bubbling of errors thrown from `unstable_patchRoutesOnMiss` ([#11786](https://github.com/remix-run/react-router/pull/11786))
222+
- Fix hydration in SSR apps using `unstable_patchRoutesOnMiss` that matched a splat route on the server ([#11790](https://github.com/remix-run/react-router/pull/11790))
223+
224+
**Full Changelog**: [`v6.24.1...v6.25.0`](https://github.com/remix-run/react-router/compare/[email protected]@6.25.0)
225+
196226
## v6.24.1
197227

198228
Date: 2024-07-03

docs/route/should-revalidate.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ interface ShouldRevalidateFunctionArgs {
2525
formData?: Submission["formData"];
2626
json?: Submission["json"];
2727
actionResult?: any;
28-
unstable_actionStatus?: number;
28+
actionStatus?: number;
2929
defaultShouldRevalidate: boolean;
3030
}
3131
```
@@ -40,8 +40,8 @@ There are several instances where data is revalidated, keeping your UI in sync w
4040

4141
- After an [`action`][action] is called via:
4242
- [`<Form>`][form], [`<fetcher.Form>`][fetcher], [`useSubmit`][usesubmit], or [`fetcher.submit`][fetcher]
43-
- When the `future.unstable_skipActionErrorRevalidation` flag is enabled, `loaders` will not revalidate by default if the `action` returns or throws a 4xx/5xx `Response`
44-
- You can opt-into revalidation for these scenarios via `shouldRevalidate` and the `unstable_actionStatus` parameter
43+
- When the `future.v7_skipActionErrorRevalidation` flag is enabled, `loaders` will not revalidate by default if the `action` returns or throws a 4xx/5xx `Response`
44+
- You can opt-into revalidation for these scenarios via `shouldRevalidate` and the `actionStatus` parameter
4545
- When an explicit revalidation is triggered via [`useRevalidator`][userevalidator]
4646
- When the [URL params][params] change for an already rendered route
4747
- When the URL Search params change

docs/routers/create-browser-router.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ The following future flags are currently available:
125125
| `v7_partialHydration` | Support partial hydration for Server-rendered apps |
126126
| `v7_prependBasename` | Prepend the router basename to navigate/fetch paths |
127127
| [`v7_relativeSplatPath`][relativesplatpath] | Fix buggy relative path resolution in splat routes |
128-
| `unstable_skipActionErrorRevalidation` | Do not revalidate by default if the action returns a 4xx/5xx `Response` |
128+
| `v7_skipActionErrorRevalidation` | Do not revalidate by default if the action returns a 4xx/5xx `Response` |
129129

130130
## `opts.hydrationData`
131131

@@ -246,7 +246,7 @@ interface HandlerResult {
246246
- If you are on `/parent/child/a` and you submit to `a`'s `action`, then only `a` will have `shouldLoad=true` for the action execution of `dataStrategy`
247247
- After the `action`, `dataStrategy` will be called again for the `loader` revalidation, and all matches will have `shouldLoad=true` (assuming no custom `shouldRevalidate` implementations)
248248

249-
The `dataStrategy` function should return a parallel array of `HandlerResult` instances, which indicates if the handler was successful or not. If the returned `handlerResult.result` is a `Response`, React Router will unwrap it for you (via `res.json` or `res.text`). If you need to do custom decoding of a `Response` but preserve the status code, you can return the decoded value in `handlerResult.result` and send the status along via `handlerResult.status` (for example, when using the `future.unstable_skipActionRevalidation` flag). `match.resolve()` will return a `HandlerResult` if you are not passing it a handler override function. If you are, then you need to wrap the `handler` result in a `HandlerResult` (see examples below).
249+
The `dataStrategy` function should return a parallel array of `HandlerResult` instances, which indicates if the handler was successful or not. If the returned `handlerResult.result` is a `Response`, React Router will unwrap it for you (via `res.json` or `res.text`). If you need to do custom decoding of a `Response` but preserve the status code, you can return the decoded value in `handlerResult.result` and send the status along via `handlerResult.status` (for example, when using the `future.v7_skipActionRevalidation` flag). `match.resolve()` will return a `HandlerResult` if you are not passing it a handler override function. If you are, then you need to wrap the `handler` result in a `HandlerResult` (see examples below).
250250

251251
### Example Use Cases
252252

docs/upgrading/future.md

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,3 +199,70 @@ createBrowserRouter(routes, {
199199
},
200200
});
201201
```
202+
203+
## v7_skipActionStatusRevalidation
204+
205+
<docs-warning>If you are not using a `createBrowserRouter` you can skip this</docs-warning>
206+
207+
When this flag is enabled, loaders will no longer revalidate by default after an action throws/returns a `Response` with a `4xx`/`5xx` status code. You may opt-into revalidation in these scenarios via `shouldRevalidate` and the `actionStatus` parameter.
208+
209+
👉 **Enable the Flag**
210+
211+
```tsx
212+
createBrowserRouter(routes, {
213+
future: {
214+
v7_skipActionStatusRevalidation: true,
215+
},
216+
});
217+
```
218+
219+
**Update your Code**
220+
221+
In most cases, you probably won't have to make changes to your app code. Usually, if an action errors, it's unlikely data was mutated and needs revalidation. If any of your code _does_ mutate data in action error scenarios you have 2 options:
222+
223+
👉 **Option 1: Change the `action` to avoid mutations in error scenarios**
224+
225+
```js
226+
// Before
227+
async function action() {
228+
await mutateSomeData();
229+
if (detectError()) {
230+
throw new Response(error, { status: 400 });
231+
}
232+
await mutateOtherData();
233+
// ...
234+
}
235+
236+
// After
237+
async function action() {
238+
if (detectError()) {
239+
throw new Response(error, { status: 400 });
240+
}
241+
// All data is now mutated after validations
242+
await mutateSomeData();
243+
await mutateOtherData();
244+
// ...
245+
}
246+
```
247+
248+
👉 **Option 2: Opt-into revalidation via `shouldRevalidate` and `actionStatus`**
249+
250+
```js
251+
async function action() {
252+
await mutateSomeData();
253+
if (detectError()) {
254+
throw new Response(error, { status: 400 });
255+
}
256+
await mutateOtherData();
257+
}
258+
259+
async function loader() { ... }
260+
261+
function shouldRevalidate({ actionStatus, defaultShouldRevalidate }) {
262+
if (actionStatus != null && actionStatus >= 400) {
263+
// Revalidate this loader when actions return a 4xx/5xx status
264+
return true;
265+
}
266+
return defaultShouldRevalidate;
267+
}
268+
```

0 commit comments

Comments
 (0)