diff --git a/tabby-core/src/components/baseTab.component.ts b/tabby-core/src/components/baseTab.component.ts index 908aa2b1..1435665d 100644 --- a/tabby-core/src/components/baseTab.component.ts +++ b/tabby-core/src/components/baseTab.component.ts @@ -195,7 +195,10 @@ export abstract class BaseTabComponent extends BaseComponent { if (!this.viewContainer || !this.viewContainerEmbeddedRef) { return } - this.viewContainer.detach(this.viewContainer.indexOf(this.viewContainerEmbeddedRef)) + const viewIndex = this.viewContainer.indexOf(this.viewContainerEmbeddedRef) + if (viewIndex !== -1) { + this.viewContainer.detach(viewIndex) + } this.viewContainerEmbeddedRef = undefined this.viewContainer = undefined } diff --git a/tabby-core/src/components/splitTab.component.ts b/tabby-core/src/components/splitTab.component.ts index c190afbd..66ba2dae 100644 --- a/tabby-core/src/components/splitTab.component.ts +++ b/tabby-core/src/components/splitTab.component.ts @@ -841,7 +841,7 @@ export class SplitTabComponent extends BaseTabComponent implements AfterViewInit tab.subscribeUntilDestroyed(tab.recoveryStateChangedHint$, () => { this.recoveryStateChangedHint.next() }) - tab.subscribeUntilDestroyed(tab.destroyed$, () => { + tab.destroyed$.subscribe(() => { this.removeTab(tab) }) }