I think I have found a bug. TurboStreams & Browser tabs

Hi I would like to discuss this github issue:

we are in the process of rewriting our chat application to hotwire and we have found that the dom modifications on Turbo are kind of queued when the browser tab is not active. Hotwire authors claims that this is a browser limitation, but we currently have the implementation on react and works ok. we have figured out this because new messages makes a sound. but with the hotwire version user must actually see the browser tab to receive the messages. it seems that this is a bug.

proof:

React version:

https://github.com/hotwired/turbo-rails/assets/11976/bd259dc5-3d9e-43eb-8968-14f01e65d762

Hotwire version

https://github.com/hotwired/turbo-rails/assets/11976/cde88095-1065-4fbe-afba-0d1b86c4b528

more context: Replace call to requestAnimationFrame in render function to update page content even if tab has lost focus · Issue #920 · hotwired/turbo · GitHub

I did a poc in which I have replaced all the nextAnimationFrame by nextMicroTask and it works!

this was fixed on main.