From 99f1d1463f560168676774a34f4b8cdf9a2fe3e5 Mon Sep 17 00:00:00 2001 From: Julius Marminge Date: Tue, 28 Oct 2025 12:21:00 -0700 Subject: [PATCH 1/2] Implement meta tag deduplication logic Add logic to determine if meta tags should be deduplicated. --- packages/react-router/src/HeadContent.tsx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/react-router/src/HeadContent.tsx b/packages/react-router/src/HeadContent.tsx index 6330e5a7495..d1afa4c0255 100644 --- a/packages/react-router/src/HeadContent.tsx +++ b/packages/react-router/src/HeadContent.tsx @@ -4,6 +4,12 @@ import { useRouter } from './useRouter' import { useRouterState } from './useRouterState' import type { RouterManagedTag } from '@tanstack/router-core' +const METAS_TO_ALLOW_MULTIPLE = new Set(['theme-color']) + +function shouldDeduplicateMetaTag(attribute: string) { + return METAS_TO_ALLOW_MULTIPLE.has(attribute) === false +} + /** * Build the list of head/link/meta/script tags to render for active matches. * Used internally by `HeadContent`. @@ -37,7 +43,7 @@ export const useTags = () => { } else { const attribute = m.name ?? m.property if (attribute) { - if (metaByAttribute[attribute]) { + if (metaByAttribute[attribute] && shouldDeduplicateMetaTag(attribute)) { continue } else { metaByAttribute[attribute] = true From 893579accf8a362c96cf959d5cb9dba27ecae3d2 Mon Sep 17 00:00:00 2001 From: "autofix-ci[bot]" <114827586+autofix-ci[bot]@users.noreply.github.com> Date: Tue, 28 Oct 2025 19:22:20 +0000 Subject: [PATCH 2/2] ci: apply automated fixes --- packages/react-router/src/HeadContent.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/react-router/src/HeadContent.tsx b/packages/react-router/src/HeadContent.tsx index d1afa4c0255..71738634d05 100644 --- a/packages/react-router/src/HeadContent.tsx +++ b/packages/react-router/src/HeadContent.tsx @@ -43,7 +43,10 @@ export const useTags = () => { } else { const attribute = m.name ?? m.property if (attribute) { - if (metaByAttribute[attribute] && shouldDeduplicateMetaTag(attribute)) { + if ( + metaByAttribute[attribute] && + shouldDeduplicateMetaTag(attribute) + ) { continue } else { metaByAttribute[attribute] = true