fix(overlays): fix OverlayController being added to a target that is already removed
This commit is contained in:
parent
6296e51a12
commit
60312054c0
2 changed files with 9 additions and 4 deletions
5
.changeset/nice-months-applaud.md
Normal file
5
.changeset/nice-months-applaud.md
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
---
|
||||||
|
'@lion/overlays': patch
|
||||||
|
---
|
||||||
|
|
||||||
|
fix(overlays): fix OverlayController being added to a target that is already removed
|
||||||
|
|
@ -166,7 +166,8 @@ export const OverlayMixinImplementation = superclass =>
|
||||||
// we do a setup after every connectedCallback as firstUpdated will only be called once
|
// we do a setup after every connectedCallback as firstUpdated will only be called once
|
||||||
this.__needsSetup = true;
|
this.__needsSetup = true;
|
||||||
this.updateComplete.then(() => {
|
this.updateComplete.then(() => {
|
||||||
if (this.__needsSetup) {
|
// The overlay can already be removed during the update, so let's make sure it is still connected
|
||||||
|
if (this.__needsSetup && this.isConnected) {
|
||||||
this._setupOverlayCtrl();
|
this._setupOverlayCtrl();
|
||||||
}
|
}
|
||||||
this.__needsSetup = false;
|
this.__needsSetup = false;
|
||||||
|
|
@ -174,9 +175,8 @@ export const OverlayMixinImplementation = superclass =>
|
||||||
}
|
}
|
||||||
|
|
||||||
disconnectedCallback() {
|
disconnectedCallback() {
|
||||||
if (super.disconnectedCallback) {
|
super.disconnectedCallback();
|
||||||
super.disconnectedCallback();
|
|
||||||
}
|
|
||||||
if (this._overlayCtrl) {
|
if (this._overlayCtrl) {
|
||||||
this._teardownOverlayCtrl();
|
this._teardownOverlayCtrl();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue