|
|
@@ -159,8 +159,9 @@ function doWatch(
|
|
|
}
|
|
|
|
|
|
let getter: () => any
|
|
|
- if (isRef(source)) {
|
|
|
- getter = () => source.value
|
|
|
+ const isRefSource = isRef(source)
|
|
|
+ if (isRefSource) {
|
|
|
+ getter = () => (source as Ref).value
|
|
|
} else if (isReactive(source)) {
|
|
|
getter = () => source
|
|
|
deep = true
|
|
|
@@ -239,7 +240,7 @@ function doWatch(
|
|
|
if (cb) {
|
|
|
// watch(source, cb)
|
|
|
const newValue = runner()
|
|
|
- if (deep || hasChanged(newValue, oldValue)) {
|
|
|
+ if (deep || isRefSource || hasChanged(newValue, oldValue)) {
|
|
|
// cleanup before running cb again
|
|
|
if (cleanup) {
|
|
|
cleanup()
|