fix(watch): flush:pre watchers should not fire if state change causes
owner component to unmount fix #2291
This commit is contained in:
@@ -509,7 +509,8 @@ describe('api: watch', () => {
|
||||
expect(cb).not.toHaveBeenCalled()
|
||||
})
|
||||
|
||||
it('should fire on component unmount w/ flush: pre', async () => {
|
||||
// #2291
|
||||
it('should not fire on component unmount w/ flush: pre', async () => {
|
||||
const toggle = ref(true)
|
||||
const cb = jest.fn()
|
||||
const Comp = {
|
||||
@@ -527,7 +528,7 @@ describe('api: watch', () => {
|
||||
expect(cb).not.toHaveBeenCalled()
|
||||
toggle.value = false
|
||||
await nextTick()
|
||||
expect(cb).toHaveBeenCalledTimes(1)
|
||||
expect(cb).not.toHaveBeenCalled()
|
||||
})
|
||||
|
||||
// #1763
|
||||
|
||||
Reference in New Issue
Block a user