fix(hydration): pass namespace when patching dynamic props#15082
Merged
edison1105 merged 2 commits intoJul 16, 2026
Conversation
When force-patching dynamic props during hydration (introduced in vuejs#9083), the element namespace is not forwarded to `patchProp`, so it defaults to `undefined`. As a result `shouldSetAsProp` treats SVG (and MathML) elements as HTML and patches read-only props such as `width`, `height` and `viewBox` as DOM properties, which throws (e.g. "Cannot set property viewBox of SVGSVGElement which has only a getter"). Forward the element's namespace via the existing `getContainerType` helper so these props are patched as attributes, matching the normal render path. close vuejs#15081 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
📝 WalkthroughWalkthroughHydration now forwards the host element namespace when patching dynamic props. Regression tests cover dynamic ChangesSVG hydration
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Size ReportBundles
Usages
|
@vue/compiler-core
@vue/compiler-dom
@vue/compiler-sfc
@vue/compiler-ssr
@vue/reactivity
@vue/runtime-core
@vue/runtime-dom
@vue/server-renderer
@vue/shared
vue
@vue/compat
commit: |
Member
|
/ecosystem-ci run |
Contributor
|
📝 Ran ecosystem CI: Open
|
kleintonno
pushed a commit
to raute1-org/LANoMAT
that referenced
this pull request
Jul 16, 2026
Bump vue to 3.5.40 to pick up the upstream "hydration: pass namespace when patching dynamic props" fix (vuejs/core#15082). Vue 3.5.39's new force-patch of dynamic props during SSR hydration hardcoded a missing SVG namespace, so patchProp mistook read-only SVG IDL properties (width/height/transform/ viewBox on rect/g/svg) for settable DOM props and threw on every hydrate, flooding the console on /events/{slug}/seating and other SVG surfaces (BracketConnector, SceneSeatmap). Pre-existing since M2; surfaced as a console-cleanliness issue during the M13 design polish. No template changes needed — the bindings were already correct. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
close #15081
close #15050
During hydration, dynamic props are force-patched, but
hydrateElementcallspatchProp(el, key, null, prop [key], undefined, parentComponent)- thenamespaceargument isundefined. runtime-dom'spatchPropderivesisSVGfrom that namespace, so SVG/MathML elements are treated as HTML and read-only props (width,height,viewBox, …) are set as DOM properties, which throws:This forwards the element's namespace via the existing
getContainerType(el)helper (already used for children hydration in the same file), so these props are patched viasetAttribute, matching the normal client render path.Regression range: 3.5.35 is unaffected (dynamic-prop force patch did not exist); 3.5.39 is broken.
Testing
Added a regression test in
hydration.spec.tsthat hydrates an<svg>with dynamicwidth/height/viewBoxand asserts they are applied as attributes. The fullruntime-coretest suite passes.Summary by CodeRabbit
Summary by CodeRabbit
Bug Fixes
Tests