You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The new `unstable_dataStrategy` API is a low-level API designed for advanced use-cases where you need to take control over the data strategy for your `loader`/`action` functions. The default implementation is today's behavior, to fetch all loaders in parallel, but this option allows users to implement more advanced data flows including Remix ["Single Fetch"](https://remix.run/docs/guides/single-fetch), user-land middleware/context APIs, automatic loader caching, and more. Please see the [docs](https://reactrouter.com/routers/create-browser-router#unstable_datastrategy) for more information.
194
+
195
+
**Note:** This is a low-level API intended for advanced use-cases. This overrides React Router's internal handling of `loader`/`action` execution, and if done incorrectly will break your app code. Please use with caution and perform the appropriate testing.
196
+
197
+
#### Skip Action Error Revalidation (unstable)
198
+
199
+
Currently, all active `loader`'s revalidate after any `action` submission, regardless of the `action` result. However, in the majority of cases a `4xx`/`5xx` response from an `action` means that no data was actually changed and the revalidation is unnecessary. We've introduced a new `future.unstable_skipActionErrorRevalidation` flag that changes the behavior here, and we plan to make this the default in future version of React Router.
200
+
201
+
With this flag enabled, `action`'s that return/throw a `4xx`/`5xx` response status will no longer automatically revalidate. If you need to revalidate after a `4xx`/`5xx` result with this flag enabled, you can still do that via returning `true` from `shouldRevalidate` - which now also receives a new `unstable_actionStatus` argument alongside `actionResult` so you can make decision based on the status of the `action` response without having to encode it into the action data.
202
+
203
+
### Minor Changes
204
+
205
+
- Add a new `unstable_dataStrategy` configuration option ([#11098](https://github.com/remix-run/react-router/pull/11098), [#11377](https://github.com/remix-run/react-router/pull/11377))
206
+
-`@remix-run/router` - Add a new `future.unstable_skipActionRevalidation` future flag ([#11098](https://github.com/remix-run/react-router/pull/11098))
207
+
-`@remix-run/router` - SSR: Added a new `skipLoaderErrorBubbling` options to the `staticHandler.query` method to disable error bubbling by the static handler for use in Remix's Single Fetch implementation ([#11098](https://github.com/remix-run/react-router/pull/11098), ([#11377](https://github.com/remix-run/react-router/pull/11377)))
Copy file name to clipboardExpand all lines: docs/route/should-revalidate.md
+4-4Lines changed: 4 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -38,10 +38,10 @@ This function allows you opt-out of revalidation for a route's [loader][loader]
38
38
39
39
There are several instances where data is revalidated, keeping your UI in sync with your data automatically:
40
40
41
-
- After an [`action`][action] is called from a [`<Form>`][form].
42
-
- After an[`action`][action] is called from a [`<fetcher.Form>`][fetcher]
43
-
- After an [`action`][action]is called from [`useSubmit`][usesubmit]
44
-
- After an [`action`][action] is called from a [`fetcher.submit`][fetcher]
41
+
- After an [`action`][action] is called via:
42
+
-[`<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
45
45
- When an explicit revalidation is triggered via [`useRevalidator`][userevalidator]
46
46
- When the [URL params][params] change for an already rendered route
0 commit comments