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

Skip to content

fix(client): process pending patches even when dirty is false#636

Merged
harlan-zw merged 1 commit into
v3from
fix/issue-530-patch-timing
Jan 6, 2026
Merged

fix(client): process pending patches even when dirty is false#636
harlan-zw merged 1 commit into
v3from
fix/issue-530-patch-timing

Conversation

@harlan-zw

Copy link
Copy Markdown
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 <[email protected]>
@harlan-zw harlan-zw changed the base branch from main to v3 January 6, 2026 07:05
@github-actions

github-actions Bot commented Jan 6, 2026

Copy link
Copy Markdown
Contributor

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
Copy Markdown
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
@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.

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

1 participant