Browse Source

fix: fix child forceUpdate regression

close #9396
dev
Evan You 6 years ago
parent
commit
44a17ba2cd
  1. 2
      src/core/vdom/helpers/normalize-scoped-slots.js
  2. 23
      test/unit/modules/vdom/patch/edge-cases.spec.js

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

@ -26,7 +26,7 @@ export function normalizeScopedSlots (
}
}
res._normalized = true
res.$stable = slots && slots.$stable
res.$stable = slots ? slots.$stable : true
return res
}

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

@ -410,4 +410,27 @@ describe('vdom patch: edge cases', () => {
expect(vm.$el.textContent).toBe('FooBar')
expect(inlineHookSpy.calls.count()).toBe(2)
})
// regression #9396
it('should not force update child with no slot content', done => {
const Child = {
updated: jasmine.createSpy(),
template: `<div></div>`
}
const parent = new Vue({
template: `<div>{{ count }}<child/></div>`,
data: {
count: 0
},
components: { Child }
}).$mount()
expect(parent.$el.textContent).toBe(`0`)
parent.count++
waitForUpdate(() => {
expect(parent.$el.textContent).toBe(`1`)
expect(Child.updated).not.toHaveBeenCalled()
}).then(done)
})
})

Loading…
Cancel
Save