refactor: remove optional chaining

This commit is contained in:
三咲智子 Kevin Deng 2024-05-30 21:46:51 +08:00
parent 334e72eeee
commit 5a0a2bfa9b
No known key found for this signature in database
2 changed files with 5 additions and 3 deletions

View File

@ -215,13 +215,13 @@ export function baseWatch(
const _cb = cb
cb = (...args) => {
_cb(...args)
effect?.stop()
effect.stop()
}
} else {
const _getter = getter
getter = () => {
_getter()
effect?.stop()
effect.stop()
}
}
}

View File

@ -842,7 +842,9 @@ export function createWatcher(
const options: WatchOptions = {}
if (__COMPAT__) {
const instance =
getCurrentScope() === currentInstance?.scope ? currentInstance : null
currentInstance && getCurrentScope() === currentInstance.scope
? currentInstance
: null
const newValue = getter()
if (