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

fix: add new emitter API to prevent memory leak #4

Merged
merged 1 commit into from
Jul 17, 2024

Conversation

web-padawan
Copy link
Member

Description

This is a better fix for vaadin/web-components#6480. See the discussion in vaadin/web-components#7547 (comment)

Once this is merged, the vaadin-rich-text-editor should be updated to revert vaadin/web-components#6506 so that we only initialize Quill in ready() and then just call emitter.connect() and emitter.disconnect() in corresponding lifecycle callbacks of the web component: connectedCallback() / disconnectedCallback()

Here's a comparison of the JS memory heap snapshots after calling detach / reattach for the RichTextEditor 20 times:

Without a fix

Tested after just reverting thtps://github.com/vaadin/web-components/pull/6506 - note the emitters aren't GCed:

Screenshot 2024-07-17 at 11 36 57

With a fix

While new web component is created on re-attach, calling emitter.disconnect() allows it to be GCed so there's only one:

Screenshot 2024-07-17 at 11 39 00

Type of change

  • Bugfix

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