Skip to content

Commit 5a0a2bf

Browse files
committed
refactor: remove optional chaining
1 parent 334e72e commit 5a0a2bf

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

packages/reactivity/src/baseWatch.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -215,13 +215,13 @@ export function baseWatch(
215215
const _cb = cb
216216
cb = (...args) => {
217217
_cb(...args)
218-
effect?.stop()
218+
effect.stop()
219219
}
220220
} else {
221221
const _getter = getter
222222
getter = () => {
223223
_getter()
224-
effect?.stop()
224+
effect.stop()
225225
}
226226
}
227227
}

packages/runtime-core/src/componentOptions.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -842,7 +842,9 @@ export function createWatcher(
842842
const options: WatchOptions = {}
843843
if (__COMPAT__) {
844844
const instance =
845-
getCurrentScope() === currentInstance?.scope ? currentInstance : null
845+
currentInstance && getCurrentScope() === currentInstance.scope
846+
? currentInstance
847+
: null
846848

847849
const newValue = getter()
848850
if (

0 commit comments

Comments
 (0)