Skip to content

Commit 8444078

Browse files
committed
fix(slots): should update compiled dynamic slots
1 parent da6e648 commit 8444078

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

packages/runtime-core/src/componentSlots.ts

+11-6
Original file line numberDiff line numberDiff line change
@@ -123,13 +123,18 @@ export const updateSlots = (
123123
let deletionComparisonTarget = EMPTY_OBJ
124124
if (vnode.shapeFlag & ShapeFlags.SLOTS_CHILDREN) {
125125
if ((children as RawSlots)._ === 1) {
126-
if (!(vnode.patchFlag & PatchFlags.DYNAMIC_SLOTS)) {
127-
// compiled AND static. this means we can skip removal of potential
128-
// stale slots
126+
// compiled slots.
127+
if (
128+
// bail on dynamic slots (v-if, v-for, reference of scope variables)
129+
!(vnode.patchFlag & PatchFlags.DYNAMIC_SLOTS) &&
130+
// bail on HRM updates
131+
!(__DEV__ && instance.parent && instance.parent.renderUpdated)
132+
) {
133+
// compiled AND static.
134+
// no need to update, and skip stale slots removal.
129135
needDeletionCheck = false
130-
}
131-
// HMR force update
132-
if (__DEV__ && instance.parent && instance.parent.renderUpdated) {
136+
} else {
137+
// compiled but dynamic - update slots, but skip normalization.
133138
extend(slots, children as Slots)
134139
}
135140
} else {

0 commit comments

Comments
 (0)