Skip to content

Commit 75b8722

Browse files
authored
fix(runtime-core): delete stale slots which are present but undefined (#6484)
close #9109
1 parent 61c1357 commit 75b8722

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

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

+3-1
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

+1-1
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)