Skip to content

Commit ef2a380

Browse files
felixbuenemannyyx990803
authored andcommitted
fix(scheduler): getNow detection can randomly fail (#9667)
The previous detection code compared time stamps based on Date.now() which are not monotonic, so the check could fail due to clock skew or adjustments. This fix changes the check to compare against performance.now() if it is supported, because it is monotonic (strictly increasing).
1 parent 781c705 commit ef2a380

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/core/observer/scheduler.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ if (
5151
inBrowser &&
5252
window.performance &&
5353
typeof performance.now === 'function' &&
54-
getNow() > document.createEvent('Event').timeStamp
54+
document.createEvent('Event').timeStamp <= performance.now()
5555
) {
5656
// if the event timestamp is bigger than the hi-res timestamp
5757
// (which is evaluated AFTER) it means the event is using a lo-res timestamp,

0 commit comments

Comments
 (0)