fix(overlays): only teardown when overlayCtrl defined

This commit is contained in:
Thijs Louisse 2020-07-04 18:50:22 +02:00
parent e04ae769ea
commit 121e1562fa

View file

@ -158,6 +158,10 @@ export const OverlayMixin = dedupeMixin(
super.disconnectedCallback();
}
if (!this._overlayCtrl) {
return;
}
this._overlayDisconnectComplete = new Promise((resolve, reject) => {
this.__resolveOverlayDisconnectComplete = resolve;
this.__rejectOverlayDisconnectComplete = reject;
@ -168,7 +172,6 @@ export const OverlayMixin = dedupeMixin(
this.__resolveOverlayDisconnectComplete();
});
if (this._overlayCtrl) {
// We need to prevent that we create a setup/teardown cycle during startup, where it
// is common that the overlay system moves around nodes. Therefore, we make the
// teardown async, so that it only happens when we are permanently disconnecting from dom
@ -178,7 +181,6 @@ export const OverlayMixin = dedupeMixin(
})
.catch(() => {});
}
}
get _overlayInvokerNode() {
return Array.from(this.children).find(child => child.slot === 'invoker');