next.js
fb67605d - fix: remove useless set-cookie in action-handler (#76839)

Commit
303 days ago
fix: remove useless set-cookie in action-handler (#76839) `handleAction` had a weird spot where it'd add a `set-cookie` header if a redirect was thrown during handling a no-js action. AFAICT, this is unnecessary -- we set the `set-cookie` header on the response as soon as `cookies().set()` is called, so there's no need to set the cookies again in that branch of the handler. this is done through a combination of the patched setter from `RequestCookies`: https://github.com/vercel/next.js/blob/0abd87717f19bced6c35af1255837628513cf772/packages/next/src/server/web/spec-extension/adapters/request-cookies.ts#L160-L171 and this cookie updating function from the request store (which `updateResponseCookies` above would invoke with the new cookies): https://github.com/vercel/next.js/blob/0abd87717f19bced6c35af1255837628513cf772/packages/next/src/server/async-storage/request-store.ts#L170-L174 i've also added a test for this specific scenario to ensure that this wasn't actually doing anything useful.
Author
Parents
Loading