Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions packages/runtime-core/__tests__/hydration.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 = '<my-element>hello</my-element>'
const root = ref()
const app = createSSRApp({
render: () =>
h('my-element', {
ref: root,
innerHTML: 'hello',
}),
})
app.mount(container)
expect(container.innerHTML).toBe('<my-element>hello</my-element>')
expect((container.firstChild as Element).hasAttribute('ref')).toBe(false)
expect(root.value).toBe(container.firstChild)
})

// #5728
test('empty text node in slot', () => {
const Comp = {
Expand Down
2 changes: 1 addition & 1 deletion packages/runtime-core/src/hydration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down
Loading