refactor: extract remove util

This commit is contained in:
Evan You
2020-02-18 13:52:59 -05:00
parent fd031490fb
commit 583f9468fa
3 changed files with 12 additions and 9 deletions

View File

@@ -14,7 +14,8 @@ import {
isFunction,
isString,
hasChanged,
NOOP
NOOP,
remove
} from '@vue/shared'
import {
currentInstance,
@@ -264,11 +265,7 @@ function doWatch(
return () => {
stop(runner)
if (instance) {
const effects = instance.effects!
const index = effects.indexOf(runner)
if (index > -1) {
effects.splice(index, 1)
}
remove(instance.effects!, runner)
}
}
}