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 30, 2023
1 parent 8f85b6d commit 735da8a
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions packages/runtime-core/src/apiWatch.ts
Expand Up @@ -220,9 +220,8 @@ function doWatch(
)
}

const instance =
getCurrentScope() === currentInstance?.scope ? currentInstance : null
// const instance = currentInstance
const scope = getCurrentScope()
const instance = currentInstance
let getter: () => any
let forceTrigger = false
let isMultiSource = false
Expand Down Expand Up @@ -259,7 +258,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 735da8a

Please sign in to comment.