Skip to content

Commit 70ea76a

Browse files
committed
fix(slots): filter out compiler marker from resolved slots
fix #1451
1 parent 7777473 commit 70ea76a

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

packages/runtime-core/src/componentSlots.ts

+7-2
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,10 @@ export const initSlots = (
102102
) => {
103103
if (instance.vnode.shapeFlag & ShapeFlags.SLOTS_CHILDREN) {
104104
if ((children as RawSlots)._ === 1) {
105-
instance.slots = children as InternalSlots
105+
const slots: InternalSlots = (instance.slots = {})
106+
for (const key in children as RawSlots) {
107+
if (key !== '_') slots[key] = (children as Slots)[key]
108+
}
106109
} else {
107110
normalizeObjectSlots(children as RawSlots, (instance.slots = {}))
108111
}
@@ -128,7 +131,9 @@ export const updateSlots = (
128131
if (__DEV__ && isHmrUpdating) {
129132
// Parent was HMR updated so slot content may have changed.
130133
// force update slots and mark instance for hmr as well
131-
extend(slots, children as Slots)
134+
for (const key in children as RawSlots) {
135+
if (key !== '_') slots[key] = (children as Slots)[key]
136+
}
132137
} else if (
133138
// bail on dynamic slots (v-if, v-for, reference of scope variables)
134139
!(vnode.patchFlag & PatchFlags.DYNAMIC_SLOTS)

0 commit comments

Comments
 (0)