Consider a scenario for items added asynchronously via WebSocket or even setInterval.
When you're on the tab that uses virtual scroller everything works flawlessly but when you switch to any other browser tab
all of subsequent updates to the table items aren't happening.
That happens because of requestAnimationFrame usage inside refresh_internal function which doesn't run on background tabs.
After coming back to the tab after a while you get white blank page and have to wait for a while for the tab to be responsive again probably because of all the rAF queued on timer queue has to run. This can be easily reproduced using list-with-api sample and switching setTimeout to setInterval .
One thing to consider is checking whether tab is active using document.hidden property or allow the library users to pass some stop function via options which will prevent rAF from queuing.
Consider a scenario for items added asynchronously via WebSocket or even setInterval. When you're on the tab that uses virtual scroller everything works flawlessly but when you switch to any other browser tab all of subsequent updates to the table items aren't happening.
That happens because of requestAnimationFrame usage inside
refresh_internal
function which doesn't run on background tabs. After coming back to the tab after a while you get white blank page and have to wait for a while for the tab to be responsive again probably because of all the rAF queued on timer queue has to run. This can be easily reproduced usinglist-with-api
sample and switchingsetTimeout
tosetInterval
.One thing to consider is checking whether tab is active using
document.hidden
property or allow the library users to pass some stop function via options which will prevent rAF from queuing.