Skip to content

Clear timers and event listeners before component unmounts#188

Closed
Arooba-git wants to merge 1 commit into
formkit:masterfrom
Arooba-git:fix-memory-leak
Closed

Clear timers and event listeners before component unmounts#188
Arooba-git wants to merge 1 commit into
formkit:masterfrom
Arooba-git:fix-memory-leak

Conversation

@Arooba-git

Copy link
Copy Markdown

Hi 👋
Thank you for this handy utility!

We found there was an event listener and a bunch of timing events that were not cleaned up on component destruction, which led to their accumulation over time, causing memory leaks. This PR clears them just before the component unmounts. You can see the difference in the count of memory leaks as detected by Memlab.

Before
Screen Shot 2024-01-07 at 9 50 33 PM

After
Screen Shot 2024-01-07 at 9 50 57 PM

@vercel

vercel Bot commented Jan 7, 2024

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
auto-animate ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 16, 2024 11:06pm

Comment thread docs/src/components/Navigation.vue Outdated
window.addEventListener("resize", () => {
resizeTimer = setTimeout(applySizing, 200)

this.$once('hook:beforeUnmount', () => {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

$once is removed in Vue 3.

:hook event prefix has also been replaced with vnode-

https://v3-migration.vuejs.org/breaking-changes/

@Arooba-git Arooba-git Jul 16, 2024

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Apologies for the delayed response. Somehow I missed the notification for this. Updated now :)

@justin-schroeder

Copy link
Copy Markdown
Member

should be cleared up in the latest releases

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.

3 participants