mirror of
https://github.com/vuejs/vue.git
synced 2024-11-21 20:28:54 +00:00
fix(reactivity): check skip first before checking ref when creating observer (#12813)
fix #12812
This commit is contained in:
parent
4a0d88e46e
commit
5d26f815c6
@ -7,7 +7,6 @@ import {
|
||||
hasOwn,
|
||||
isArray,
|
||||
hasProto,
|
||||
isObject,
|
||||
isPlainObject,
|
||||
isPrimitive,
|
||||
isUndef,
|
||||
@ -108,23 +107,21 @@ export function observe(
|
||||
shallow?: boolean,
|
||||
ssrMockReactivity?: boolean
|
||||
): Observer | void {
|
||||
if (!isObject(value) || isRef(value) || value instanceof VNode) {
|
||||
return
|
||||
if (value && hasOwn(value, '__ob__') && value.__ob__ instanceof Observer) {
|
||||
return value.__ob__
|
||||
}
|
||||
let ob: Observer | void
|
||||
if (hasOwn(value, '__ob__') && value.__ob__ instanceof Observer) {
|
||||
ob = value.__ob__
|
||||
} else if (
|
||||
if (
|
||||
shouldObserve &&
|
||||
(ssrMockReactivity || !isServerRendering()) &&
|
||||
(isArray(value) || isPlainObject(value)) &&
|
||||
Object.isExtensible(value) &&
|
||||
!value.__v_skip /* ReactiveFlags.SKIP */ &&
|
||||
!rawMap.has(value)
|
||||
!rawMap.has(value) &&
|
||||
!isRef(value) &&
|
||||
!(value instanceof VNode)
|
||||
) {
|
||||
ob = new Observer(value, shallow, ssrMockReactivity)
|
||||
return new Observer(value, shallow, ssrMockReactivity)
|
||||
}
|
||||
return ob
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user