Skip to content
This repository was archived by the owner on Feb 22, 2018. It is now read-only.

Commit 3db2752

Browse files
vicbrkirov
authored andcommitted
fix(cd): inline _looseIdentical() where it should be
fixes #1656 revert a bug introduced in f01e286
1 parent e623b40 commit 3db2752

File tree

1 file changed

+14
-10
lines changed

1 file changed

+14
-10
lines changed

lib/change_detection/dirty_checking_change_detector.dart

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -622,10 +622,18 @@ class DirtyCheckingRecord<H> implements WatchRecord<H> {
622622
}
623623

624624
var last = currentValue;
625-
if (!_looseIdentical(last, current)) {
626-
previousValue = currentValue;
627-
currentValue = current;
628-
return true;
625+
if (!identical(last, current)) {
626+
if (last is String && current is String && last == current) {
627+
// This is false change in strings we need to recover, and pretend it
628+
// is the same. We save the value so that next time identity will pass
629+
currentValue = current;
630+
} else if (last is num && last.isNaN && current is num && current.isNaN) {
631+
// we need this for the compiled JavaScript since in JS NaN !== NaN.
632+
} else {
633+
previousValue = last;
634+
currentValue = current;
635+
return true;
636+
}
629637
}
630638
return false;
631639
}
@@ -1538,12 +1546,8 @@ class DuplicateMap {
15381546
bool _looseIdentical(dst, src) {
15391547
if (identical(dst, src)) return true;
15401548

1541-
if (dst is String && src is String && dst == src) {
1542-
// this is false change in strings we need to recover, and pretend it is the same. We save the
1543-
// value so that next time identity can pass
1544-
dst = src;
1545-
return true;
1546-
}
1549+
// Dart could have string1 == string2 without identical(string1, string2)
1550+
if (dst is String && src is String && dst == src) return true;
15471551

15481552
// we need this for JavaScript since in JS NaN !== NaN.
15491553
if (dst is num && (dst as num).isNaN && src is num && (src as num).isNaN) return true;

0 commit comments

Comments
 (0)