router
router copied to clipboard
Document head content defined in HTML is not deduplicated
Which project does this relate to?
Router
Describe the bug
With SPAs, some document head content is typically set in HTML before JS is run. The current HeadContent implementation seems to not take this into account and duplicate these tags if overwritten by JS.
Your Example Website or App
https://stackblitz.com/edit/github-ahupwy5s?file=src%2Fmain.tsx
Steps to Reproduce the Bug or Issue
- Open the provided example.
- Inspect the document tree in dev tools.
- Title and meta tags from JS are duplicated instead of overwriting the base values from HTML.
Expected behavior
Router should take the document head content defined in HTML as base for modification by JS.
Screenshots or Videos
Platform
- OS: any
- Browser: any
- Version: any
Additional context
No response
I have a similar problem. When I use the title tag outside of meta, the title doesn't change. I moved title inside of meta and it doesnt dedup (but the title does change, as in your example)
Using vite with @tanstack/[email protected] and react19