Skip to content

Commit abb3a81

Browse files
authored
fix(compiler-core): detected forwarded slots in nested components (#4268)
fix #4244
1 parent a211e27 commit abb3a81

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

Diff for: packages/compiler-core/__tests__/transforms/vSlot.spec.ts

+7
Original file line numberDiff line numberDiff line change
@@ -778,6 +778,13 @@ describe('compiler: transform component slots', () => {
778778
)
779779
expect(slots).toMatchObject(toMatch)
780780
})
781+
782+
test('<slot w/ nested component>', () => {
783+
const { slots } = parseWithSlots(
784+
`<Comp><Comp><slot/></Comp></Comp>`
785+
)
786+
expect(slots).toMatchObject(toMatch)
787+
})
781788
})
782789

783790
describe('errors', () => {

Diff for: packages/compiler-core/src/transforms/vSlot.ts

+1-3
Original file line numberDiff line numberDiff line change
@@ -384,9 +384,7 @@ function hasForwardedSlots(children: TemplateChildNode[]): boolean {
384384
case NodeTypes.ELEMENT:
385385
if (
386386
child.tagType === ElementTypes.SLOT ||
387-
((child.tagType === ElementTypes.ELEMENT ||
388-
child.tagType === ElementTypes.TEMPLATE) &&
389-
hasForwardedSlots(child.children))
387+
hasForwardedSlots(child.children)
390388
) {
391389
return true
392390
}

0 commit comments

Comments
 (0)