Skip to content

Commit e230cb7

Browse files
committed
fix doNotObserve flag for null values
1 parent f6f9ea4 commit e230cb7

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/observer/index.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import Dep from './dep'
22
import { arrayMethods } from './array'
33
import {
44
def,
5+
isObject,
56
isArray,
67
isPlainObject,
78
hasProto,
@@ -191,7 +192,7 @@ export function defineReactive (obj, key, val, doNotObserve) {
191192
// this allows freezing a large object from the root and
192193
// avoid unnecessary observation inside v-for fragments.
193194
var childOb = doNotObserve
194-
? typeof val === 'object' && val.__ob__
195+
? isObject(val) && val.__ob__
195196
: observe(val)
196197
Object.defineProperty(obj, key, {
197198
enumerable: true,
@@ -223,7 +224,7 @@ export function defineReactive (obj, key, val, doNotObserve) {
223224
val = newVal
224225
}
225226
childOb = doNotObserve
226-
? typeof newVal === 'object' && newVal.__ob__
227+
? isObject(newVal) && newVal.__ob__
227228
: observe(newVal)
228229
dep.notify()
229230
}

0 commit comments

Comments
 (0)