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

If an adopter disconnects in between animation frames, it throws an error during restyling #112

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

jorgea-stripe
Copy link

While callers of restyleAdopter check if their adopters are connected, restyleAdopter contains a call to requestAnimationFrame which means that adopters can be disconnected while the browser is waiting for the next repaint.

Here's the error that is thrown under those circumstances:
image.

This error bubbles up as an unhandled exception in certain apps (like in this NextJS setup):
image, as well as in the console.

The fix is to take into account that nodes may become disconnected in the callback of requestAnimationFrame. With this update, I can no longer repro this race condition.

@jorgea-stripe
Copy link
Author

@calebdwilliams would appreciate any feedback or a review for this fix!

@calebdwilliams
Copy link
Owner

@jorgea-stripe looks like the tests failed.

@jorgea-stripe
Copy link
Author

jorgea-stripe commented Jun 23, 2022

@calebdwilliams - I believe my latest change should fix the test that broke due to an outdated browser message! (I've run it locally however I don't have permission to run on the CI)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants