Skip to content

Commit e3ef24f

Browse files
KaelWDlumozx
authored andcommitted
fix(runtime-core): delete stale slots which are present but undefined (vuejs#6484)
close vuejs#9109
1 parent a31232b commit e3ef24f

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,9 +134,11 @@ describe('component: slots', () => {
134134
}
135135

136136
const oldSlots = {
137-
header: 'header'
137+
header: 'header',
138+
footer: undefined
138139
}
139140
const newSlots = {
141+
header: undefined,
140142
footer: 'footer'
141143
}
142144

packages/runtime-core/src/componentSlots.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ export const updateSlots = (
234234
// delete stale slots
235235
if (needDeletionCheck) {
236236
for (const key in slots) {
237-
if (!isInternalKey(key) && !(key in deletionComparisonTarget)) {
237+
if (!isInternalKey(key) && deletionComparisonTarget[key] == null) {
238238
delete slots[key]
239239
}
240240
}

0 commit comments

Comments
 (0)