mirror of
https://github.com/vuejs/vue.git
synced 2024-11-21 20:28:54 +00:00
parent
bd89ce53a9
commit
f0057b101e
@ -274,10 +274,7 @@ function doWatch(
|
||||
let oldValue = isMultiSource ? [] : INITIAL_WATCHER_VALUE
|
||||
// overwrite default run
|
||||
watcher.run = () => {
|
||||
if (
|
||||
!watcher.active &&
|
||||
!(flush === 'pre' && instance && instance._isBeingDestroyed)
|
||||
) {
|
||||
if (!watcher.active) {
|
||||
return
|
||||
}
|
||||
if (cb) {
|
||||
|
@ -542,7 +542,7 @@ describe('api: watch', () => {
|
||||
expect(cb).not.toHaveBeenCalled()
|
||||
})
|
||||
|
||||
it('should fire on component unmount w/ flush: pre', async () => {
|
||||
it('should not fire on component unmount w/ flush: pre', async () => {
|
||||
const toggle = ref(true)
|
||||
const cb = vi.fn()
|
||||
const Comp = {
|
||||
@ -560,7 +560,7 @@ describe('api: watch', () => {
|
||||
expect(cb).not.toHaveBeenCalled()
|
||||
toggle.value = false
|
||||
await nextTick()
|
||||
expect(cb).toHaveBeenCalledTimes(1)
|
||||
expect(cb).not.toHaveBeenCalled()
|
||||
})
|
||||
|
||||
// vuejs/core#1763
|
||||
|
Loading…
Reference in New Issue
Block a user