fix(switch): unregister as formElement on disconnected

This commit is contained in:
Thijs Louisse 2022-04-06 16:10:23 +02:00
parent 24b205837e
commit 355aabc02c
2 changed files with 6 additions and 0 deletions

View file

@ -0,0 +1,5 @@
---
'@lion/switch': patch
---
fix(switch) unregister on disconnectedCallback

View file

@ -88,6 +88,7 @@ export class LionSwitch extends ScopedElementsMixin(ChoiceInputMixin(LionField))
} }
disconnectedCallback() { disconnectedCallback() {
super.disconnectedCallback();
if (this._inputNode) { if (this._inputNode) {
this.removeEventListener('checked-changed', this.__handleButtonSwitchCheckedChanged); this.removeEventListener('checked-changed', this.__handleButtonSwitchCheckedChanged);
} }