XHR/setTimeout/Promise not finishing until scrolling stops in Chrome XHR/setTimeout/Promise not finishing until scrolling stops in Chrome google-chrome google-chrome

XHR/setTimeout/Promise not finishing until scrolling stops in Chrome


Depending on your exact scenario and desired browser support, I'd try Service Workers - which are meant for tasks such as the one you're handling (and can intercept all traffic), or a Web Worker to do your AJAX in the background.


Since this has to do with the engine, I don't think a workaround is possible. Instead I have filed a bug report with the Chrome team.

https://bugs.chromium.org/p/chromium/issues/detail?id=661155


I believe this may be related to this Chrome feature:

https://www.chromestatus.com/feature/5745543795965952 (Passive event listeners)

Chrome tries to avoid doing work on mobile when the user is scrolling, so listening to touchmove events can sometimes delay handlers being run and timeouts from firing.

Demo:
https://rbyers.github.io/scroll-latency.html
(check Handler Jank and scroll around the page)