Skip to content

Commit

Permalink
fix: fix child forceUpdate regression
Browse files Browse the repository at this point in the history
close #9396
  • Loading branch information
yyx990803 committed Jan 31, 2019
1 parent 539e481 commit 44a17ba
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/core/vdom/helpers/normalize-scoped-slots.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export function normalizeScopedSlots (
}
}
res._normalized = true
res.$stable = slots && slots.$stable
res.$stable = slots ? slots.$stable : true
return res
}

Expand Down
23 changes: 23 additions & 0 deletions test/unit/modules/vdom/patch/edge-cases.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
})
})

0 comments on commit 44a17ba

Please sign in to comment.