Skip to content

Commit

Permalink
fix(runtime-core): delete stale slots which are present but undefined (
Browse files Browse the repository at this point in the history
  • Loading branch information
KaelWD authored Oct 20, 2023
1 parent 61c1357 commit 75b8722
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion packages/runtime-core/__tests__/componentSlots.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,9 +134,11 @@ describe('component: slots', () => {
}

const oldSlots = {
header: 'header'
header: 'header',
footer: undefined
}
const newSlots = {
header: undefined,
footer: 'footer'
}

Expand Down
2 changes: 1 addition & 1 deletion packages/runtime-core/src/componentSlots.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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]
}
}
Expand Down

0 comments on commit 75b8722

Please sign in to comment.