Skip to content

Commit

Permalink
fix(watch): replace instance unmounted with scope inactive
Browse files Browse the repository at this point in the history
  • Loading branch information
yangmingshan committed Dec 31, 2023
1 parent 24d77c2 commit f8ea946
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions packages/runtime-core/src/apiWatch.ts
Expand Up @@ -220,8 +220,8 @@ function doWatch(
)
}

const instance =
getCurrentScope() === currentInstance?.scope ? currentInstance : null
const scope = getCurrentScope()
const instance = currentInstance
const reactiveGetter = (source: object) =>
deep === true
? source // traverse will happen in wrapped getter below
Expand Down Expand Up @@ -261,7 +261,7 @@ function doWatch(
} else {
// no cb -> simple effect
getter = () => {
if (instance && instance.isUnmounted) {
if (scope && !scope.active) {
return
}
if (cleanup) {
Expand Down

0 comments on commit f8ea946

Please sign in to comment.