Skip to content

Commit f8ea946

Browse files
committed
fix(watch): replace instance unmounted with scope inactive
1 parent 24d77c2 commit f8ea946

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

packages/runtime-core/src/apiWatch.ts

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

223-
const instance =
224-
getCurrentScope() === currentInstance?.scope ? currentInstance : null
223+
const scope = getCurrentScope()
224+
const instance = currentInstance
225225
const reactiveGetter = (source: object) =>
226226
deep === true
227227
? source // traverse will happen in wrapped getter below
@@ -261,7 +261,7 @@ function doWatch(
261261
} else {
262262
// no cb -> simple effect
263263
getter = () => {
264-
if (instance && instance.isUnmounted) {
264+
if (scope && !scope.active) {
265265
return
266266
}
267267
if (cleanup) {

0 commit comments

Comments
 (0)