File tree 1 file changed +12
-2
lines changed
1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -37,6 +37,16 @@ enum ComputedWatchInitStatus {
37
37
38
38
let computedWatchDefIdInc = 0
39
39
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
+
40
50
export const behavior = Behavior ( {
41
51
lifetimes : {
42
52
attached ( this : BehaviorExtend ) {
@@ -117,7 +127,7 @@ export const behavior = Behavior({
117
127
for ( let i = 0 ; i < oldPathValues . length ; i ++ ) {
118
128
const { path, value : oldVal } = oldPathValues [ i ]
119
129
const curVal = dataPath . getDataOnPath ( this . data , path )
120
- if ( oldVal !== curVal ) {
130
+ if ( ! equal ( oldVal , curVal ) ) {
121
131
needUpdate = true
122
132
break
123
133
}
@@ -220,7 +230,7 @@ export const behavior = Behavior({
220
230
if (
221
231
deepCmp
222
232
? ! deepEqual ( oldVal [ i ] , curVal [ i ] )
223
- : oldVal [ i ] !== curVal [ i ]
233
+ : ! equal ( oldVal [ i ] , curVal [ i ] )
224
234
) {
225
235
changed = true
226
236
break
You can’t perform that action at this time.
0 commit comments