Perf tweak

This commit is contained in:
Aria Minaei 2021-07-05 15:23:44 +02:00
parent ffbfbe4519
commit 1cff694df2

View file

@ -127,7 +127,9 @@ function queueIfNeeded() {
let i = 0 let i = 0
while (queue.length > 0) { while (queue.length > 0) {
i++ i++
if (i > 5) { if (i === 4) {
// react might be skipping updates, perhaps in concurrent mode.
//we can recheck the queue later
setTimeout(queueIfNeeded, 1) setTimeout(queueIfNeeded, 1)
break break
} }
@ -135,7 +137,7 @@ function queueIfNeeded() {
for (const item of queue) { for (const item of queue) {
item.runUpdate() item.runUpdate()
} }
}) }, 1)
} }
microtaskIsQueued = false microtaskIsQueued = false
}) })