Use 255 instead of infinity
Infinity is a floating point value.
Andrew Clark committed
Dec 14, 2016 at 13:42 UTC
3a946fe0944aab319c7b73fb196314c80c955027
1 file changed
+3
-3
src/renderers/shared/fiber/ReactFiberUpdateQueue.js
+3
-3
@@ -69,10 +69,10 @@ function comparePriority(a : PriorityLevel, b : PriorityLevel) : number {
69
return 0;
70
}
71
if (a === NoWork && b !== NoWork) {
72
- return -Infinity;
72
+ return -255;
73
}
74
if (a !== NoWork && b === NoWork) {
75
- return Infinity;
75
+ return 255;
76
}
77
return a - b;
78
}
@@ -299,7 +299,7 @@ function addReplaceUpdate(
299
for (let i = 0; queue && i < 2; i++) {
300
let replaceAfter = null;
301
let replaceBefore = queue.first;
302
- let comparison = Infinity;
302
+ let comparison = 255;
303
while (replaceBefore &&
304
(comparison = comparePriority(replaceBefore.priorityLevel, priorityLevel)) <= 0) {
305
if (comparison < 0) {