Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Page refreshes: Replace remaining calls to nextAnimationFrame by nextRepaint #1102

Merged

Conversation

brunoprietog
Copy link
Collaborator

@brunoprietog brunoprietog commented Dec 6, 2023

In #1042, nextRepaint util was created, which only calls nextAnimationFrame when the page is in the foreground, and when it is in the background it calls nextEventLoopTick. Then, nextAnimationFrame was replaced in the StreamElement render method to allow Turbo streams actions to run even if the page is in the background.

Now that a page refresh can also be triggered by Turbo streams, it is necessary to change the remaining calls to nextAnimationFrame, so that page refreshes and Turbo frame reloads can occur in the background as well.

So, this change ensures that page refreshes work properly when the page is in the background.

This ensures that page refreshes work properly when the page is in the background.
@afcapel afcapel merged commit db310ef into hotwired:main Dec 7, 2023
1 check passed
@afcapel
Copy link
Collaborator

afcapel commented Dec 7, 2023

Thanks @brunoprietog!

@brunoprietog brunoprietog deleted the more-nextAnimationFrame-replacements branch December 7, 2023 13:44
domchristie pushed a commit to domchristie/turbo that referenced this pull request Jul 20, 2024
…d#1102)

This ensures that page refreshes work properly when the page is in the background.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants