diff --git a/packages/runtime-core/__tests__/componentSlots.spec.ts b/packages/runtime-core/__tests__/componentSlots.spec.ts index f08f1910cd4..708fb20c423 100644 --- a/packages/runtime-core/__tests__/componentSlots.spec.ts +++ b/packages/runtime-core/__tests__/componentSlots.spec.ts @@ -134,9 +134,11 @@ describe('component: slots', () => { } const oldSlots = { - header: 'header' + header: 'header', + footer: undefined } const newSlots = { + header: undefined, footer: 'footer' } diff --git a/packages/runtime-core/src/componentSlots.ts b/packages/runtime-core/src/componentSlots.ts index afc5f03933b..980ee799186 100644 --- a/packages/runtime-core/src/componentSlots.ts +++ b/packages/runtime-core/src/componentSlots.ts @@ -234,7 +234,7 @@ export const updateSlots = ( // delete stale slots if (needDeletionCheck) { for (const key in slots) { - if (!isInternalKey(key) && !(key in deletionComparisonTarget)) { + if (!isInternalKey(key) && deletionComparisonTarget[key] == null) { delete slots[key] } }