wip: disable tracking in all hooks

This commit is contained in:
Evan You
2019-09-04 18:20:47 -04:00
parent 13298bc4fa
commit a6de6daa17
3 changed files with 20 additions and 0 deletions

View File

@@ -107,11 +107,24 @@ function cleanup(effect: ReactiveEffect) {
}
}
let shouldTrack = true
export function pauseTracking() {
shouldTrack = false
}
export function resumeTracking() {
shouldTrack = true
}
export function track(
target: any,
type: OperationTypes,
key?: string | symbol
) {
if (!shouldTrack) {
return
}
const effect = activeReactiveEffectStack[activeReactiveEffectStack.length - 1]
if (effect) {
if (type === OperationTypes.ITERATE) {