fix(reactivity): account for NaN in value change checks (#361)

This commit is contained in:
Mayness
2019-10-23 10:53:43 -05:00
committed by Evan You
parent 11d0778f9c
commit 18a349ce8c
7 changed files with 47 additions and 8 deletions

View File

@@ -7,7 +7,14 @@ import {
ReactiveEffectOptions
} from '@vue/reactivity'
import { queueJob } from './scheduler'
import { EMPTY_OBJ, isObject, isArray, isFunction, isString } from '@vue/shared'
import {
EMPTY_OBJ,
isObject,
isArray,
isFunction,
isString,
hasChanged
} from '@vue/shared'
import { recordEffect } from './apiReactivity'
import {
currentInstance,
@@ -144,7 +151,7 @@ function doWatch(
return
}
const newValue = runner()
if (deep || newValue !== oldValue) {
if (deep || hasChanged(newValue, oldValue)) {
// cleanup before running cb again
if (cleanup) {
cleanup()