Skip to content

Commit 41158e8

Browse files
bteaabdullah-wn
authored andcommitted
chore: improve renderComponentRoot warn message (vuejs#10914)
1 parent 11c1e7b commit 41158e8

File tree

2 files changed

+22
-1
lines changed

2 files changed

+22
-1
lines changed

packages/runtime-core/__tests__/rendererAttrsFallthrough.spec.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import {
77
Fragment,
88
type FunctionalComponent,
9+
Teleport,
910
createBlock,
1011
createCommentVNode,
1112
createElementBlock,
@@ -391,6 +392,26 @@ describe('attribute fallthrough', () => {
391392
expect(`Extraneous non-emits event listeners`).toHaveBeenWarned()
392393
})
393394

395+
it('should warn when fallthrough fails on teleport root node', () => {
396+
const Parent = {
397+
render() {
398+
return h(Child, { class: 'parent' })
399+
},
400+
}
401+
const root = document.createElement('div')
402+
403+
const Child = defineComponent({
404+
render() {
405+
return h(Teleport, { to: root }, h('div'))
406+
},
407+
})
408+
409+
document.body.appendChild(root)
410+
render(h(Parent), root)
411+
412+
expect(`Extraneous non-props attributes (class)`).toHaveBeenWarned()
413+
})
414+
394415
it('should dedupe same listeners when $attrs is used during render', () => {
395416
const click = vi.fn()
396417
const count = ref(0)

packages/runtime-core/src/componentRenderUtils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ export function renderComponentRoot(
190190
`Extraneous non-props attributes (` +
191191
`${extraAttrs.join(', ')}) ` +
192192
`were passed to component but could not be automatically inherited ` +
193-
`because component renders fragment or text root nodes.`,
193+
`because component renders fragment or text or teleport root nodes.`,
194194
)
195195
}
196196
if (eventAttrs.length) {

0 commit comments

Comments
 (0)