Thanks to visit codestin.com
Credit goes to github.com

Skip to content

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

Merged
harlan-zw merged 1 commit intomainfrom
fix/dedupe-script-link-tags-main
Feb 25, 2026
Merged

fix(unhead): deduplicate matching tags inside same render cycle#668
harlan-zw merged 1 commit intomainfrom
fix/dedupe-script-link-tags-main

Conversation

@harlan-zw
Copy link
Collaborator

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

πŸ”— 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
Copy link
Contributor

github-actions bot commented Feb 25, 2026

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
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