fix(runtime-core): delete stale slots which are present but undefined (#6484)
close #9109
This commit is contained in:
parent
61c1357427
commit
75b8722135
|
@ -134,9 +134,11 @@ describe('component: slots', () => {
|
||||||
}
|
}
|
||||||
|
|
||||||
const oldSlots = {
|
const oldSlots = {
|
||||||
header: 'header'
|
header: 'header',
|
||||||
|
footer: undefined
|
||||||
}
|
}
|
||||||
const newSlots = {
|
const newSlots = {
|
||||||
|
header: undefined,
|
||||||
footer: 'footer'
|
footer: 'footer'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -234,7 +234,7 @@ export const updateSlots = (
|
||||||
// delete stale slots
|
// delete stale slots
|
||||||
if (needDeletionCheck) {
|
if (needDeletionCheck) {
|
||||||
for (const key in slots) {
|
for (const key in slots) {
|
||||||
if (!isInternalKey(key) && !(key in deletionComparisonTarget)) {
|
if (!isInternalKey(key) && deletionComparisonTarget[key] == null) {
|
||||||
delete slots[key]
|
delete slots[key]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue