Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

fix(unhead): deduplicate matching tags inside same render cycle#668

Merged
harlan-zw merged 1 commit into
mainunjs/unhead:mainfrom
fix/dedupe-script-link-tags-mainunjs/unhead:fix/dedupe-script-link-tags-mainCopy head branch name to clipboard
Feb 25, 2026
Merged

fix(unhead): deduplicate matching tags inside same render cycle#668
harlan-zw merged 1 commit into
mainunjs/unhead:mainfrom
fix/dedupe-script-link-tags-mainunjs/unhead:fix/dedupe-script-link-tags-mainCopy head branch name to clipboard

Conversation

@harlan-zw

@harlan-zw harlan-zw commented Feb 25, 2026

Copy link
Copy Markdown
Collaborator

🔗 Linked issue

Closes #666

❓ Type of change

  • 📖 Documentation
  • 🐞 Bug fix
  • 👌 Enhancement
  • ✨ New feature
  • 🧹 Chore
  • ⚠️ Breaking change

📚 Description

Tags without an explicit dedup key (script[src], link[href]) were keyed by their unique position index during tag resolution, so identical tags from separate entries were never deduplicated within the same render cycle.

Now falls back to hashTag() (content-based hash) instead of position index, so matching tags collide and deduplicate correctly. The hash is precomputed during normalization and cached on _h to avoid recomputation in the DOM renderer.

@harlan-zw harlan-zw changed the title fix(unhead): deduplicate script[src] and link[href] tags across entries fix(unhead): deduplicate matching tags inside same render cycle Feb 25, 2026
@github-actions

github-actions Bot commented Feb 25, 2026

Copy link
Copy Markdown
Contributor

Bundle Size Analysis

Bundle Size Gzipped
Client (Minimal) 11.4 kB 4.7 kB
Server (Minimal) 10.3 kB → 10.4 kB 🔴 +0.2 kB 4.2 kB → 4.3 kB 🔴 +0.1 kB
Vue Client (Minimal) 12.3 kB 5.1 kB
Vue Server (Minimal) 11.1 kB → 11.3 kB 🔴 +0.2 kB 4.6 kB → 4.6 kB 🔴 +0.1 kB

…ntries

Tags without an explicit dedup key (like `script[src]` and `link[href]`) were
keyed by their unique position index in `dedupeTags()`, meaning identical tags
from separate entries were never deduplicated.

Now falls back to `hashTag()` (content-based hash) instead of position, so
identical tags collide and deduplicate. The hash is precomputed during tag
normalization and cached on `_h` to avoid recomputation in the DOM renderer.

Closes #666
@harlan-zw
harlan-zw force-pushed the fix/dedupe-script-link-tags-main branch from 3704c23 to 0eea994 Compare February 25, 2026 11:36
@harlan-zw
harlan-zw merged commit 5c0b293 into main Feb 25, 2026
5 checks passed
@harlan-zw harlan-zw mentioned this pull request Apr 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

script and link tags are not deduplicated (compared to react-helmet-async)

1 participant

Morty Proxy This is a proxified and sanitized view of the page, visit original site.