MattDavis00 / lottie-svelte

https://www.npmjs.com/package/lottie-svelte
MIT License
9 stars 2 forks source link

The `destroy` method is not being called #21

Closed rbozan closed 10 months ago

rbozan commented 10 months ago

I have a feeling this library slows down my application after showing a lot of animations. Now I am seeing that the lottie-web library has a destroy method: https://github.com/airbnb/lottie-web#destroy but I don't see this method being called here on destroy of the component. I am not sure if that is needed?

Simply adding

        return () => {
            animation.destroy()
        }

to the onMount function would fix it.

See: https://github.com/MattDavis00/lottie-svelte/pull/22

MattDavis00 commented 10 months ago

Fixed and merged in https://github.com/MattDavis00/lottie-svelte/pull/22

MattDavis00 commented 10 months ago

Fix is included in the lastest release: https://github.com/MattDavis00/lottie-svelte/releases/tag/v1.3.7 https://www.npmjs.com/package/lottie-svelte/v/1.3.7