solid-start icon indicating copy to clipboard operation
solid-start copied to clipboard

[Bug?]: Set-Cookie header not applied to request during single-flight mutation (SFM)

Open yinonburgansky opened this issue 4 months ago • 1 comments

Duplicates

  • [x] I have searched the existing issues

Latest version

  • [x] I have tested the 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")

yinonburgansky avatar Sep 04 '25 12:09 yinonburgansky