Duplicates
Latest version
Current behavior 😯
When a server action throws a redirect with a Set-Cookie header, the cookie is applied to the response but not merged into the subsequent server-side request context of the single flight mutation.
That means any server queries that read cookies from the incoming request during the same flight won't see the newly-set cookie. The behavior differs from a full client round-trip, where the browser would include the cookie on the next request.
Expected behavior 🤔
Single-flight mutations should behave as if a round trip occurred: any headers (such as Set-Cookie, referrer) set on the response should be reflected in the request for subsequent server logic, to ensure consistent behavior.
Steps to reproduce 🕹
const serverFunc = action(async () => {
"use server"
throw redirect("/", {
headers: {
"Set-Cookie": "val=1234; Path=/; HttpOnly; SameSite=Lax; Max-Age=3600",
}
})
}, "serverFunc")
Duplicates
Latest version
Current behavior 😯
When a server action throws a redirect with a Set-Cookie header, the cookie is applied to the response but not merged into the subsequent server-side request context of the single flight mutation.
That means any server queries that read cookies from the incoming request during the same flight won't see the newly-set cookie. The behavior differs from a full client round-trip, where the browser would include the cookie on the next request.
Expected behavior 🤔
Single-flight mutations should behave as if a round trip occurred: any headers (such as Set-Cookie, referrer) set on the response should be reflected in the request for subsequent server logic, to ensure consistent behavior.
Steps to reproduce 🕹