Comments (8)
This has been fixed in #1826 by making sure the controls are connected before appending them to form data. Tests have been added to prevent regressions.
from shoelace.
May be related to #1708
from shoelace.
The leak of form controls causes the <form>
to retain the values of the removed form controls.
- Have a
<form>
with three inputs A=1, B=2, C=3. - Call
new FormData(form)
and getA=1&B=2&C=3
as expected. - Remove inputs A and B from the form.
- Call
new FormData(form)
again and getA=1&B=2&C=3
even though A and B got removed. - Remove input C from the form.
- Call
new FormData(form)
again and getA=1&B=2
. The input of C got removed. This is probably because thehandleFormData
listener is only removed for the last form control.
See this codepen for a demo: https://codepen.io/hbgl/pen/vYPxevY
from shoelace.
@claviska Thanks for the fix. There is still the issue of the memory leak that was not addressed by e231f8a. I would assume that for form-heavy SPAs this might be an issue.
from shoelace.
If I'm understanding what you're reporting, references to the detached form controls will be garbage collected if you're not using them. Browsers do this at their discretion, and we can't forcedly destroy them because it's common to disconnect and reconnect elements in the DOM.
If you're seeing long-lived elements that have been disconnected, make sure you don't have any references to them in variables, WeakMaps, etc.
from shoelace.
@claviska There seems to be some internal reference that keeps the form and the form controls alive. I removed the form control from the DOM and I have no other references, however, it is still not getting garbage collected. Eventually the browser tab will run out of memory. Here is a codepen to illustrate the issue:
https://codepen.io/hbgl/pen/mdoMzXj
from shoelace.
Feel free to open a fresh issue for this specific problem. I'm not seeing anything obvious in the form controller, but it's possible we missed something. We'll also want to compare it to other browsers to make sure it's not Chrome-related.
from shoelace.
@claviska Will do. After a quick test I can say that the memory leak also occurs in Firefox.
from shoelace.
Related Issues (20)
- Spinners do not display properly in Safari HOT 2
- As I'm a C++ guy ... HOT 2
- How to remove Lit In dev mode warning?
- sl-textarea may throw error on disconnectedCallback because input element is not found HOT 1
- Shoelace Element not updating when using Async-Pipes in Angular or async data in vue HOT 2
- carousel with "slide-per-page" is not working properly in rtl documents HOT 1
- `@watch()` shouldn't patch the prototype every time it's used. HOT 2
- Looping Carousel is out of order when inside of Sl-Resize-Observer
- Menu: Submenus: Right to Left: Submenu Location and Arrows not flipped
- Localisation does not respect browser settings HOT 3
- Events should subclass Event instead of using CustomEvents HOT 1
- Autofocus doesn't work on sl-input in Firefox and Safari HOT 2
- Submenus in dropdown panels don't scroll HOT 1
- <sl-color-picker hoist> causes warning due to non-passive touchmove listener HOT 2
- sl-drawer issues when using keyboard navigation HOT 1
- Event bubbling doesn't appear to be working as described: event bubbles up then circles back around to the child element HOT 1
- events like sl-hide bubbling is confusing HOT 1
- page shake when dialog opend HOT 3
- sl-popup in scrollable section in<dialog> gets clipped in safari
- Dark theme not working, when installed via NPM HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from shoelace.