diff --git a/.changeset/dry-toes-sneeze.md b/.changeset/dry-toes-sneeze.md new file mode 100644 index 0000000000..e93a21191f --- /dev/null +++ b/.changeset/dry-toes-sneeze.md @@ -0,0 +1,5 @@ +--- +"react-router": patch +--- + +Throw unwrapped single fetch redirect to align with pre-single fetch behavior diff --git a/packages/react-router/lib/dom/ssr/single-fetch.tsx b/packages/react-router/lib/dom/ssr/single-fetch.tsx index 7829b400ca..301d29428b 100644 --- a/packages/react-router/lib/dom/ssr/single-fetch.tsx +++ b/packages/react-router/lib/dom/ssr/single-fetch.tsx @@ -522,7 +522,7 @@ function unwrapSingleFetchResult(result: SingleFetchResult, routeId: string) { if (result.replace) { headers["X-Remix-Replace"] = "yes"; } - return redirect(result.redirect, { status: result.status, headers }); + throw redirect(result.redirect, { status: result.status, headers }); } else if ("data" in result) { return result.data; } else {