From: Daniel Roe Date: Mon, 19 Jan 2026 00:52:43 +0000 (+0000) Subject: fix(runtime-core): skip patching reserved props for custom elements (#14275) X-Git-Tag: v3.5.27~4 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=19cc7e2cd053629f3233cd55dff98951e69f5391;p=thirdparty%2Fvuejs%2Fcore.git fix(runtime-core): skip patching reserved props for custom elements (#14275) close #14274 --- diff --git a/packages/runtime-core/__tests__/hydration.spec.ts b/packages/runtime-core/__tests__/hydration.spec.ts index dffa2bc224..7017c0414f 100644 --- a/packages/runtime-core/__tests__/hydration.spec.ts +++ b/packages/runtime-core/__tests__/hydration.spec.ts @@ -1597,6 +1597,24 @@ describe('SSR hydration', () => { expect((container.firstChild as any).foo).toBe(msg.value) }) + // #14274 + test('should not render ref on custom element during hydration', () => { + const container = document.createElement('div') + container.innerHTML = 'hello' + const root = ref() + const app = createSSRApp({ + render: () => + h('my-element', { + ref: root, + innerHTML: 'hello', + }), + }) + app.mount(container) + expect(container.innerHTML).toBe('hello') + expect((container.firstChild as Element).hasAttribute('ref')).toBe(false) + expect(root.value).toBe(container.firstChild) + }) + // #5728 test('empty text node in slot', () => { const Comp = { diff --git a/packages/runtime-core/src/hydration.ts b/packages/runtime-core/src/hydration.ts index a9ce641321..a687d28d38 100644 --- a/packages/runtime-core/src/hydration.ts +++ b/packages/runtime-core/src/hydration.ts @@ -507,7 +507,7 @@ export function createHydrationFunctions( (isOn(key) && !isReservedProp(key)) || // force hydrate v-bind with .prop modifiers key[0] === '.' || - isCustomElement + (isCustomElement && !isReservedProp(key)) ) { patchProp(el, key, null, props[key], undefined, parentComponent) }