From d216bca0c995ea1a34dda23055a92b8001c50619 Mon Sep 17 00:00:00 2001 From: Matt Brophy Date: Wed, 11 Dec 2024 13:38:48 -0500 Subject: [PATCH] Throw single fetch redirects fetched from the server (#10317) --- .changeset/unlucky-melons-promise.md | 5 +++++ packages/remix-react/single-fetch.tsx | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 .changeset/unlucky-melons-promise.md diff --git a/.changeset/unlucky-melons-promise.md b/.changeset/unlucky-melons-promise.md new file mode 100644 index 00000000000..b43ab5968b4 --- /dev/null +++ b/.changeset/unlucky-melons-promise.md @@ -0,0 +1,5 @@ +--- +"@remix-run/react": patch +--- + +Throw unwrapped single fetch redirect to align with pre-single fetch behavior diff --git a/packages/remix-react/single-fetch.tsx b/packages/remix-react/single-fetch.tsx index ca81746e004..6a47b80c6be 100644 --- a/packages/remix-react/single-fetch.tsx +++ b/packages/remix-react/single-fetch.tsx @@ -491,7 +491,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 {