diff --git a/src/core/instance/lifecycle.js b/src/core/instance/lifecycle.js index debe94bc06..5754e3fa34 100644 --- a/src/core/instance/lifecycle.js +++ b/src/core/instance/lifecycle.js @@ -233,6 +233,7 @@ export function updateChildComponent ( (parentVnode.data.scopedSlots && !parentVnode.data.scopedSlots.$stable) || (vm.$scopedSlots !== emptyObject && !vm.$scopedSlots.$stable) ) + // Any static slot children from the parent may have changed during parent's // update. Dynamic scoped slots may also have changed. In such cases, a forced // update is necessary to ensure correctness. diff --git a/src/core/vdom/helpers/normalize-scoped-slots.js b/src/core/vdom/helpers/normalize-scoped-slots.js index e4197428d8..b575ff605e 100644 --- a/src/core/vdom/helpers/normalize-scoped-slots.js +++ b/src/core/vdom/helpers/normalize-scoped-slots.js @@ -1,6 +1,7 @@ /* @flow */ import { hasOwn } from 'shared/util' +import { def } from 'core/util/lang' import { normalizeChildren } from 'core/vdom/helpers/normalize-children' export function normalizeScopedSlots ( @@ -26,8 +27,8 @@ export function normalizeScopedSlots ( res[key] = proxyNormalSlot(normalSlots, key) } } - res._normalized = true - res.$stable = slots ? slots.$stable : true + def(res, '_normalized', true) + def(res, '$stable', slots ? !!slots.$stable : true) return res } diff --git a/test/unit/features/component/component-scoped-slot.spec.js b/test/unit/features/component/component-scoped-slot.spec.js index 9a2dd0cc71..b520cf1e6b 100644 --- a/test/unit/features/component/component-scoped-slot.spec.js +++ b/test/unit/features/component/component-scoped-slot.spec.js @@ -969,4 +969,27 @@ describe('Component scoped slot', () => { }).then(done) } }) + + // regression #9396 + it('should not force update child with no slot content', done => { + const Child = { + updated: jasmine.createSpy(), + template: `
` + } + + const parent = new Vue({ + template: `