diff --git a/packages/remix-dev/__tests__/readConfig-test.ts b/packages/remix-dev/__tests__/readConfig-test.ts index e1f795537c7..3267b8717ef 100644 --- a/packages/remix-dev/__tests__/readConfig-test.ts +++ b/packages/remix-dev/__tests__/readConfig-test.ts @@ -34,6 +34,7 @@ describe("readConfig", () => { unstable_postcss: expect.any(Boolean), unstable_tailwind: expect.any(Boolean), v2_errorBoundary: expect.any(Boolean), + v2_headers: expect.any(Boolean), v2_meta: expect.any(Boolean), v2_normalizeFormMethod: expect.any(Boolean), v2_routeConvention: expect.any(Boolean), @@ -55,6 +56,7 @@ describe("readConfig", () => { "unstable_postcss": Any, "unstable_tailwind": Any, "v2_errorBoundary": Any, + "v2_headers": Any, "v2_meta": Any, "v2_normalizeFormMethod": Any, "v2_routeConvention": Any, diff --git a/packages/remix-dev/config.ts b/packages/remix-dev/config.ts index 8f427f9dc80..575391c273e 100644 --- a/packages/remix-dev/config.ts +++ b/packages/remix-dev/config.ts @@ -55,6 +55,7 @@ interface FutureConfig { /** @deprecated Use the `tailwind` config option instead */ unstable_tailwind: boolean; v2_errorBoundary: boolean; + v2_headers: boolean; v2_meta: boolean; v2_normalizeFormMethod: boolean; v2_routeConvention: boolean; @@ -738,6 +739,7 @@ export async function readConfig( unstable_postcss: appConfig.future?.unstable_postcss === true, unstable_tailwind: appConfig.future?.unstable_tailwind === true, v2_errorBoundary: appConfig.future?.v2_errorBoundary === true, + v2_headers: appConfig.future?.v2_headers === true, v2_meta: appConfig.future?.v2_meta === true, v2_normalizeFormMethod: appConfig.future?.v2_normalizeFormMethod === true, v2_routeConvention: appConfig.future?.v2_routeConvention === true, diff --git a/packages/remix-react/entry.ts b/packages/remix-react/entry.ts index fde03eca196..d2a2ab2f269 100644 --- a/packages/remix-react/entry.ts +++ b/packages/remix-react/entry.ts @@ -33,6 +33,7 @@ export interface FutureConfig { /** @deprecated Use the `tailwind` config option instead */ unstable_tailwind: boolean; v2_errorBoundary: boolean; + v2_headers: boolean; v2_meta: boolean; v2_normalizeFormMethod: boolean; v2_routeConvention: boolean; diff --git a/packages/remix-server-runtime/entry.ts b/packages/remix-server-runtime/entry.ts index 1191e01ccfc..ea09f729b7c 100644 --- a/packages/remix-server-runtime/entry.ts +++ b/packages/remix-server-runtime/entry.ts @@ -25,6 +25,7 @@ export interface FutureConfig { /** @deprecated Use the `tailwind` config option instead */ unstable_tailwind: boolean; v2_errorBoundary: boolean; + v2_headers: boolean; v2_meta: boolean; v2_normalizeFormMethod: boolean; v2_routeConvention: boolean; diff --git a/packages/remix-server-runtime/headers.ts b/packages/remix-server-runtime/headers.ts index c242b87c051..15004d51514 100644 --- a/packages/remix-server-runtime/headers.ts +++ b/packages/remix-server-runtime/headers.ts @@ -24,6 +24,8 @@ export function getDocumentHeadersRR( ? typeof routeModule.headers === "function" ? routeModule.headers({ loaderHeaders, parentHeaders, actionHeaders }) : routeModule.headers + : build.future.v2_headers + ? parentHeaders : undefined ); @@ -40,7 +42,10 @@ export function getDocumentHeadersRR( function prependCookies(parentHeaders: Headers, childHeaders: Headers): void { let parentSetCookieString = parentHeaders.get("Set-Cookie"); - if (parentSetCookieString) { + if ( + parentSetCookieString && + parentSetCookieString !== childHeaders.get("Set-Cookie") + ) { let cookies = splitCookiesString(parentSetCookieString); cookies.forEach((cookie) => { childHeaders.append("Set-Cookie", cookie); diff --git a/packages/remix-testing/create-remix-stub.tsx b/packages/remix-testing/create-remix-stub.tsx index 1ef4b85ada0..b7f0f464791 100644 --- a/packages/remix-testing/create-remix-stub.tsx +++ b/packages/remix-testing/create-remix-stub.tsx @@ -128,6 +128,7 @@ export function createRemixStub( unstable_postcss: false, unstable_tailwind: false, v2_errorBoundary: false, + v2_headers: false, v2_meta: false, v2_normalizeFormMethod: false, v2_routeConvention: false,