|
|
@@ -43,7 +43,6 @@ import { DeprecationTypes } from './compat/compatConfig'
|
|
|
import { checkCompatEnabled, isCompatEnabled } from './compat/compatConfig'
|
|
|
import { ObjectWatchOptionItem } from './componentOptions'
|
|
|
import { useSSRContext } from '@vue/runtime-core'
|
|
|
-import { SSRContext } from '@vue/server-renderer'
|
|
|
|
|
|
export type WatchEffect = (onCleanup: OnCleanup) => void
|
|
|
|
|
|
@@ -297,7 +296,7 @@ function doWatch(
|
|
|
])
|
|
|
}
|
|
|
if (flush === 'sync') {
|
|
|
- const ctx = useSSRContext() as SSRContext
|
|
|
+ const ctx = useSSRContext()!
|
|
|
ssrCleanup = ctx.__watcherHandles || (ctx.__watcherHandles = [])
|
|
|
} else {
|
|
|
return NOOP
|
|
|
@@ -318,9 +317,7 @@ function doWatch(
|
|
|
deep ||
|
|
|
forceTrigger ||
|
|
|
(isMultiSource
|
|
|
- ? (newValue as any[]).some((v, i) =>
|
|
|
- hasChanged(v, (oldValue as any[])[i])
|
|
|
- )
|
|
|
+ ? (newValue as any[]).some((v, i) => hasChanged(v, oldValue[i]))
|
|
|
: hasChanged(newValue, oldValue)) ||
|
|
|
(__COMPAT__ &&
|
|
|
isArray(newValue) &&
|
|
|
@@ -461,7 +458,7 @@ export function traverse(value: unknown, seen?: Set<unknown>) {
|
|
|
})
|
|
|
} else if (isPlainObject(value)) {
|
|
|
for (const key in value) {
|
|
|
- traverse((value as any)[key], seen)
|
|
|
+ traverse(value[key], seen)
|
|
|
}
|
|
|
}
|
|
|
return value
|