Skip to content

Commit

Permalink
Throw single fetch redirects fetched from the server (#12506)
Browse files Browse the repository at this point in the history
  • Loading branch information
brophdawg11 authored Dec 11, 2024
1 parent 64e0a03 commit 7cd5c54
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/dry-toes-sneeze.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"react-router": patch
---

Throw unwrapped single fetch redirect to align with pre-single fetch behavior
2 changes: 1 addition & 1 deletion packages/react-router/lib/dom/ssr/single-fetch.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 7cd5c54

Please sign in to comment.