Skip to content

Commit

Permalink
Adopt RR stabilized v7_skipActionErrorRevalidation flag (#9706)
Browse files Browse the repository at this point in the history
  • Loading branch information
brophdawg11 authored Jul 12, 2024
1 parent 5bccd1e commit f8389c5
Show file tree
Hide file tree
Showing 9 changed files with 41 additions and 35 deletions.
6 changes: 6 additions & 0 deletions .changeset/quiet-pugs-allow.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@remix-run/react": patch
---

Single Fetch (unstable): Adopt React Router's stabilized `future.v7_skipActionErrorRevalidation` under the hood
- This also stabilizes the `shouldRevalidate` parameter from `unstable_actionStatus` to `actionStatus`
2 changes: 1 addition & 1 deletion docs/guides/single-fetch.md
Original file line number Diff line number Diff line change
Expand Up @@ -540,7 +540,7 @@ Previously, Remix would always revalidate all active loaders after _any_ action

With Single Fetch, if an `action` returns or throws a `Response` with a `4xx/5xx` status code, Remix will _not revalidate_ loaders by default. If an `action` returns or throws anything that is not a 4xx/5xx Response, then the revalidation behavior is unchanged. The reasoning here is that in most cases, if you return a `4xx`/`5xx` Response, you didn't actually mutate any data so there is no need to reload data.

If you _want_ to continue revalidating one or more loaders after a 4xx/5xx action response, you can opt-into revalidation on a per-route basis by returning `true` from your [`shouldRevalidate`][should-revalidate] function. There is also a new `unstable_actionStatus` parameter passed to the function that you can use if you need to decide based on the action status code.
If you _want_ to continue revalidating one or more loaders after a 4xx/5xx action response, you can opt-into revalidation on a per-route basis by returning `true` from your [`shouldRevalidate`][should-revalidate] function. There is also a new `actionStatus` parameter passed to the function that you can use if you need to decide based on the action status code.

Revalidation is handled via a `?_routes` query string parameter on the single fetch HTTP call which limits the loaders being called. This means that when you are doing fine-grained revalidation, you will have cache enumerations based on the routes being requested - but all of the information is in the URL so you should not need any special CDN configurations (as opposed to if this was done via a custom header that required your CDN to respect the `Vary` header).

Expand Down
2 changes: 1 addition & 1 deletion integration/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"@remix-run/dev": "workspace:*",
"@remix-run/express": "workspace:*",
"@remix-run/node": "workspace:*",
"@remix-run/router": "1.17.1",
"@remix-run/router": "1.18.0-pre.0",
"@remix-run/server-runtime": "workspace:*",
"@types/express": "^4.17.9",
"@vanilla-extract/css": "^1.10.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/remix-dev/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"@mdx-js/mdx": "^2.3.0",
"@npmcli/package-json": "^4.0.1",
"@remix-run/node": "workspace:*",
"@remix-run/router": "1.17.1",
"@remix-run/router": "1.18.0-pre.0",
"@remix-run/server-runtime": "workspace:*",
"@types/mdx": "^2.0.5",
"@vanilla-extract/integration": "^6.2.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/remix-react/browser.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ export function RemixBrowser(_props: RemixBrowserProps): ReactElement {
v7_prependBasename: true,
v7_relativeSplatPath: window.__remixContext.future.v3_relativeSplatPath,
// Single fetch enables this underlying behavior
unstable_skipActionErrorRevalidation:
v7_skipActionErrorRevalidation:
window.__remixContext.future.unstable_singleFetch === true,
},
hydrationData,
Expand Down
6 changes: 3 additions & 3 deletions packages/remix-react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@
"tsc": "tsc"
},
"dependencies": {
"@remix-run/router": "1.17.1",
"@remix-run/router": "1.18.0-pre.0",
"@remix-run/server-runtime": "workspace:*",
"react-router": "6.24.1",
"react-router-dom": "6.24.1",
"react-router": "6.25.0-pre.0",
"react-router-dom": "6.25.0-pre.0",
"turbo-stream": "2.2.0"
},
"devDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/remix-server-runtime/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"tsc": "tsc"
},
"dependencies": {
"@remix-run/router": "1.17.1",
"@remix-run/router": "1.18.0-pre.0",
"@types/cookie": "^0.6.0",
"@web3-storage/multipart-parser": "^1.0.0",
"cookie": "^0.6.0",
Expand Down
4 changes: 2 additions & 2 deletions packages/remix-testing/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
"dependencies": {
"@remix-run/node": "workspace:*",
"@remix-run/react": "workspace:*",
"@remix-run/router": "1.17.1",
"react-router-dom": "6.24.1"
"@remix-run/router": "1.18.0-pre.0",
"react-router-dom": "6.25.0-pre.0"
},
"devDependencies": {
"@remix-run/server-runtime": "workspace:*",
Expand Down
50 changes: 25 additions & 25 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit f8389c5

Please sign in to comment.