Skip to content

Conversation

@harlan-zw
Copy link
Collaborator

Summary

  • Fixes issue where useHead with reactive values that change after SSR hydration would remove old tags but not add new ones
  • Root cause: when patch() is called during/after a render, the render completes and sets dirty = false before the debounced render fires, causing it to skip processing _pending patches

Changes

  • Modified renderDOMHead.ts to check for pending patches as fallback when dirty is false
  • Added comprehensive tests for patch timing scenarios

Test plan

  • All 740 existing tests pass
  • New tests cover:
    • Processing pending patches when dirty is false
    • Rapid patches during render cycle
    • Rendering new tags after old tags removed
    • Issue 530 reproduction with debounced renderer
    • Concurrent render race condition

Closes #530

🤖 Generated with Claude Code

When `patch()` is called during or after a render cycle, the render may
complete and set `dirty = false` before the debounced render fires.
This caused the debounced render to skip processing `_pending` patches.

The fix checks for pending patches as a fallback when `dirty` is false,
ensuring reactive updates are always rendered.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@harlan-zw harlan-zw changed the base branch from main to v3 January 6, 2026 07:05
@github-actions
Copy link
Contributor

github-actions bot commented Jan 6, 2026

Bundle Size Analysis

Bundle Size Gzipped
Client (Minimal) 11.2 kB → 10.1 kB 🟢 1.2 kB 4.7 kB → 4.2 kB 🟢 0.5 kB
Server (Minimal) 10.1 kB → 9.7 kB 🟢 0.5 kB 4.2 kB → 4 kB 🟢 0.2 kB
Vue Client (Minimal) 12.3 kB → 11.1 kB 🟢 1.2 kB 5.1 kB → 4.6 kB 🟢 0.5 kB
Vue Server (Minimal) 11 kB → 10.6 kB 🟢 0.5 kB 4.5 kB → 4.4 kB 🟢 0.2 kB

@harlan-zw
Copy link
Collaborator Author

Code review

No issues found. Checked for bugs and CLAUDE.md compliance.

🤖 Generated with Claude Code

- If this code review was useful, please react with 👍. Otherwise, react with 👎.

@harlan-zw harlan-zw merged commit 37db290 into v3 Jan 6, 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.

[v2] Calling useHead in the client after SSR no longer updates the tags in the head but instead removes existing

2 participants