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,16 +172,14 @@ 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
this._overlayDisconnectComplete
.then(() => {
this._teardownOverlayCtrl();
})
.catch(() => {});
}
// 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
this._overlayDisconnectComplete
.then(() => {
this._teardownOverlayCtrl();
})
.catch(() => {});
}
get _overlayInvokerNode() {