Skip to content

Conversation

@trueadm
Copy link
Contributor

@trueadm trueadm commented Aug 11, 2024

Fixes #12719.

12759 previously would null the effect on animation. I thought it wasn't necessary, but clearly it still is (I removed transitions from my example and forgot to put them back in, oops). I think we should flag this with Chromium folks as it seems odd that we need to do this – having it makes no difference in Firefox.

I also noticed that the catch function retains the animation in Firefox. I don't think we even need it anymore, so that fixes the memory leak in Firefox. Strangely, this doesn't seem to affect Chromium.

Lastly, clearing on_finish and on_abort seems to help the memory profile in Firefox and Chromium. Given we do it in deactivate, it makes sense to do in abort too.

@changeset-bot
Copy link

changeset-bot bot commented Aug 11, 2024

🦋 Changeset detected

Latest commit: b568ad3

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
svelte Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

animation.cancel();
}
})
.catch((e) => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The catch is necessary to prevent an unhandled rejection when a transition is aborted:

image

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah yeah, I remember now. That sucks :/ can't think of why it causes FF to leak. I've tried making the animation undefined inside it but that doesn't help.

@Rich-Harris Rich-Harris merged commit 97c0150 into main Aug 11, 2024
@Rich-Harris Rich-Harris deleted the more-transition-memory-leaks branch August 11, 2024 10:58
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.

Svelte 5 memory leak after transitions

3 participants