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
Form and form control memory leak #1841
Comments
I've made a deep dive and am honestly unsure whether this may be a bug in Lit. Here's an shoelace-free example which shows the same problem:
Because there's no Shoelace involved here, I think that's something for the Lit team. |
Thanks for looking into this, @cyantree! @justinfagnani is this something you might want to look into? |
@cyantree We currently ship Lit ^3.0.0 and I believe 3.1.2 is the latest if you want to test that version specifically. |
Lit doesn't do anything to the elements though. As far as Lit is concerned, Are we sure this isn't a Chrome bug? Did you try this with plain web components? |
Here's an example with plain web components: It seems this might be related to ShadowDOM as these elements doesn't seem to be cleaned up nicely. Here is a test which demonstrates a strange behaviour and might indeed point to a bug in Chromium:
Can you confirm my observation? |
I can confirm. I did a bit more testing and the memory leak depends on when the shadow DOM is attached. If you attach it inside the constructor, then there is no leak. If you attach it inside Lit attaches the shadow DOM inside Check out this codepen: https://codepen.io/hbgl/pen/oNVOMWj |
Thanks for checking it out further. If you create the shadow DOM in the constructor but still append the input element in |
Describe the bug
I have a
<form>
with one or more Shoelace form controls. When removing a form control or the form itself from the DOM, both the form and the form controls are leaked. To clarify: there are no other references in the application code that keep these objects alive.Previous issue: #1823
To Reproduce
<form>
with one or more form controls, e.g.<sl-input>
.<form>
from the DOM. It is also leaked.Note: Before checking for leaked objects, use the dev tools to force a garbage collection.
Demo
https://codepen.io/hbgl/pen/mdoMzXj
Browser / OS
The text was updated successfully, but these errors were encountered: