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

Leaking/performance issues when adding/removing from tree #35

Closed
ccnokes opened this issue Jun 23, 2021 · 5 comments
Closed

Leaking/performance issues when adding/removing from tree #35

ccnokes opened this issue Jun 23, 2021 · 5 comments

Comments

@ccnokes
Copy link

ccnokes commented Jun 23, 2021

If the player is added/removed from the tree, something internally is leaking and it can cause the animation to jank and then the page to crash.

See this sandbox: https://codesandbox.io/s/elated-tdd-pvhkf?file=/src/App.tsx

Click the toggle button once. Everything works and the animation shows. Click it twice and it might be a bit slower. 3-4+ times (at least on my computer) it slows to a crawl and the page becomes unresponsive.

@mifi
Copy link
Owner

mifi commented Jun 24, 2021

Thanks for nice report! I also managed to reproduce the issue with your codesandbox.

Seems this is an issue with upstream lottie-web. I found these: airbnb/lottie-web#1159 airbnb/lottie-web#2151

The solution is to use something like lodash.clonedeep on the animationData. e.g. animationData={cloneDeep(animationData)}

I will update react-lottie-player with this cloning code, because this is such a sneaky bug and it shouldn't be on the developers' shoulders to have to experience this crash.

@mifi mifi closed this as completed in 2d0b6b9 Jun 24, 2021
@mifi
Copy link
Owner

mifi commented Jun 24, 2021

this will be fixed in the next version

@victorlaforga
Copy link

I upgraded to 1.3.2 but with no result...
Could you help me with this?

https://pensive-gates-96535d.netlify.app/

Schermafbeelding 2021-06-24 om 08 55 21

@mifi
Copy link
Owner

mifi commented Jun 24, 2021

I believe your issue is #30, please continue discussion there

@ccnokes
Copy link
Author

ccnokes commented Jun 24, 2021

🎉🎉🎉

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

No branches or pull requests

3 participants