Skip to content

Commit

Permalink
fix: Dangling references after element disconnect (#608)
Browse files Browse the repository at this point in the history
Several components did not call the parent `disconnectedCallback`,
preventing triggering `hostDisconnected`
for any controllers (theming in this case) and
leading to a memory leak.

Co-authored-by: Simeon Simeonoff <sim.simeonoff@gmail.com>
  • Loading branch information
rkaraivanov and simeonoff authored Jan 10, 2023
1 parent 12cbd28 commit d19a8b0
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/components/checkbox/checkbox-base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ export class IgcCheckboxBaseComponent extends EventEmitterMixin<

public override disconnectedCallback() {
this.removeEventListener('keyup', this.handleKeyUp);
super.disconnectedCallback();
}

protected handleKeyUp() {
Expand Down
1 change: 1 addition & 0 deletions src/components/radio/radio.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ export default class IgcRadioComponent extends EventEmitterMixin<

public override disconnectedCallback() {
this.removeEventListener('keyup', this.handleKeyUp);
super.disconnectedCallback();
}

protected handleKeyUp() {
Expand Down
1 change: 1 addition & 0 deletions src/components/select/select-group.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ export default class IgcSelectGroupComponent extends IgcDropdownGroupComponent {

public override disconnectedCallback() {
this.observer.disconnect();
super.disconnectedCallback();
}

protected override getParent() {
Expand Down
1 change: 1 addition & 0 deletions src/components/slider/slider-base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,7 @@ export class IgcSliderBaseComponent extends LitElement {

public override disconnectedCallback() {
this.removeEventListener('keyup', this.handleKeyUp);
super.disconnectedCallback();
}

protected handleKeyUp() {
Expand Down

0 comments on commit d19a8b0

Please sign in to comment.