Skip to content

Commit

Permalink
fix(slots): should update compiled dynamic slots
Browse files Browse the repository at this point in the history
  • Loading branch information
yyx990803 committed Apr 8, 2020
1 parent da6e648 commit 8444078
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions packages/runtime-core/src/componentSlots.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,13 +123,18 @@ export const updateSlots = (
let deletionComparisonTarget = EMPTY_OBJ
if (vnode.shapeFlag & ShapeFlags.SLOTS_CHILDREN) {
if ((children as RawSlots)._ === 1) {
if (!(vnode.patchFlag & PatchFlags.DYNAMIC_SLOTS)) {
// compiled AND static. this means we can skip removal of potential
// stale slots
// compiled slots.
if (
// bail on dynamic slots (v-if, v-for, reference of scope variables)
!(vnode.patchFlag & PatchFlags.DYNAMIC_SLOTS) &&
// bail on HRM updates
!(__DEV__ && instance.parent && instance.parent.renderUpdated)
) {
// compiled AND static.
// no need to update, and skip stale slots removal.
needDeletionCheck = false
}
// HMR force update
if (__DEV__ && instance.parent && instance.parent.renderUpdated) {
} else {
// compiled but dynamic - update slots, but skip normalization.
extend(slots, children as Slots)
}
} else {
Expand Down

0 comments on commit 8444078

Please sign in to comment.