Skip to content

Commit 44a17ba

Browse files
committedJan 31, 2019
fix: fix child forceUpdate regression
close #9396
1 parent 539e481 commit 44a17ba

File tree

2 files changed

+24
-1
lines changed

2 files changed

+24
-1
lines changed
 

‎src/core/vdom/helpers/normalize-scoped-slots.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ export function normalizeScopedSlots (
2626
}
2727
}
2828
res._normalized = true
29-
res.$stable = slots && slots.$stable
29+
res.$stable = slots ? slots.$stable : true
3030
return res
3131
}
3232

‎test/unit/modules/vdom/patch/edge-cases.spec.js

+23
Original file line numberDiff line numberDiff line change
@@ -410,4 +410,27 @@ describe('vdom patch: edge cases', () => {
410410
expect(vm.$el.textContent).toBe('FooBar')
411411
expect(inlineHookSpy.calls.count()).toBe(2)
412412
})
413+
414+
// regression #9396
415+
it('should not force update child with no slot content', done => {
416+
const Child = {
417+
updated: jasmine.createSpy(),
418+
template: `<div></div>`
419+
}
420+
421+
const parent = new Vue({
422+
template: `<div>{{ count }}<child/></div>`,
423+
data: {
424+
count: 0
425+
},
426+
components: { Child }
427+
}).$mount()
428+
429+
expect(parent.$el.textContent).toBe(`0`)
430+
parent.count++
431+
waitForUpdate(() => {
432+
expect(parent.$el.textContent).toBe(`1`)
433+
expect(Child.updated).not.toHaveBeenCalled()
434+
}).then(done)
435+
})
413436
})

0 commit comments

Comments
 (0)
Please sign in to comment.