Skip to content

Commit 735da8a

Browse files
committed
fix(watch): replace instance unmounted with scope inactive
1 parent 8f85b6d commit 735da8a

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

packages/runtime-core/src/apiWatch.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -220,9 +220,8 @@ function doWatch(
220220
)
221221
}
222222

223-
const instance =
224-
getCurrentScope() === currentInstance?.scope ? currentInstance : null
225-
// const instance = currentInstance
223+
const scope = getCurrentScope()
224+
const instance = currentInstance
226225
let getter: () => any
227226
let forceTrigger = false
228227
let isMultiSource = false
@@ -259,7 +258,7 @@ function doWatch(
259258
} else {
260259
// no cb -> simple effect
261260
getter = () => {
262-
if (instance && instance.isUnmounted) {
261+
if (scope && !scope.active) {
263262
return
264263
}
265264
if (cleanup) {

0 commit comments

Comments
 (0)