File tree Expand file tree Collapse file tree 1 file changed +12
-2
lines changed
Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -37,6 +37,16 @@ enum ComputedWatchInitStatus {
3737
3838let computedWatchDefIdInc = 0
3939
40+ function equal ( a : unknown , b : unknown ) {
41+ if ( a === b ) {
42+ return true
43+ } else {
44+ // When a = b = NaN
45+ // NaN === NaN is false
46+ return a !== a && b !== b
47+ }
48+ }
49+
4050export const behavior = Behavior ( {
4151 lifetimes : {
4252 attached ( this : BehaviorExtend ) {
@@ -117,7 +127,7 @@ export const behavior = Behavior({
117127 for ( let i = 0 ; i < oldPathValues . length ; i ++ ) {
118128 const { path, value : oldVal } = oldPathValues [ i ]
119129 const curVal = dataPath . getDataOnPath ( this . data , path )
120- if ( oldVal !== curVal ) {
130+ if ( ! equal ( oldVal , curVal ) ) {
121131 needUpdate = true
122132 break
123133 }
@@ -220,7 +230,7 @@ export const behavior = Behavior({
220230 if (
221231 deepCmp
222232 ? ! deepEqual ( oldVal [ i ] , curVal [ i ] )
223- : oldVal [ i ] !== curVal [ i ]
233+ : ! equal ( oldVal [ i ] , curVal [ i ] )
224234 ) {
225235 changed = true
226236 break
You can’t perform that action at this time.
0 commit comments