Skip to content

Commit c884cd8

Browse files
committed
chore: remove unused detachedLoaderRef
1 parent 9aacc9f commit c884cd8

1 file changed

Lines changed: 3 additions & 9 deletions

File tree

  • packages/angular/src/lib/legacy/directives

packages/angular/src/lib/legacy/directives/dialogs.ts

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import { ApplicationRef, ComponentRef, Injectable, Injector, NgModuleRef, NgZone
22
import { Application, ContentView, Frame, ShowModalOptions, View, ViewBase } from '@nativescript/core';
33
import { Subject } from 'rxjs';
44
import { AppHostAsyncView, AppHostView } from '../../app-host-view';
5-
import { DetachedLoader } from '../../cdk/detached-loader';
65
import { ComponentPortal } from '../../cdk/portal/common';
76
import { NativeScriptDomPortalOutlet } from '../../cdk/portal/nsdom-portal-outlet';
87
import { didModalOpen, once } from '../../utils/general';
@@ -117,7 +116,6 @@ export class ModalDialogService {
117116

118117
private _showDialog(options: ShowDialogOptions): void {
119118
let componentViewRef: NgViewRef<unknown>;
120-
let detachedLoaderRef: ComponentRef<DetachedLoader>;
121119
let portalOutlet: NativeScriptDomPortalOutlet;
122120

123121
const closeCallback = once(async (...args) => {
@@ -129,11 +127,9 @@ export class ModalDialogService {
129127
this._closed$.next(params);
130128
}
131129
await this.location._closeModalNavigation();
132-
if (detachedLoaderRef || portalOutlet) {
130+
if (portalOutlet) {
133131
this.zone.run(() => {
134132
portalOutlet?.dispose();
135-
detachedLoaderRef?.instance.detectChanges();
136-
detachedLoaderRef?.destroy();
137133
});
138134
}
139135
}
@@ -169,7 +165,7 @@ export class ModalDialogService {
169165
const modalView = componentViewRef.firstNativeLikeView;
170166
options.parentView.showModal(modalView, { ...options, closeCallback });
171167
if (!didModalOpen(options.parentView as View, modalView)) {
172-
this._handleFailedOpen(modalParams, portalOutlet, detachedLoaderRef);
168+
this._handleFailedOpen(modalParams, portalOutlet);
173169
}
174170
});
175171
}
@@ -179,15 +175,13 @@ export class ModalDialogService {
179175
* failed to actually present it. Without this the modal navigation stack stays incremented
180176
* (blocking further navigation) and the attached view/loader leak on the `ApplicationRef`.
181177
*/
182-
private _handleFailedOpen(modalParams: ModalDialogParams, portalOutlet?: NativeScriptDomPortalOutlet, detachedLoaderRef?: ComponentRef<DetachedLoader>): never {
178+
private _handleFailedOpen(modalParams: ModalDialogParams, portalOutlet?: NativeScriptDomPortalOutlet): never {
183179
const index = this.openedModalParams?.indexOf(modalParams) ?? -1;
184180
if (index > -1) {
185181
this.openedModalParams.splice(index, 1);
186182
}
187183
this.location?._closeModalNavigation();
188184
portalOutlet?.dispose();
189-
detachedLoaderRef?.instance.detectChanges();
190-
detachedLoaderRef?.destroy();
191185
throw new Error('Failed to open dialog: the modal view could not be presented. This usually happens when another modal is already being presented.');
192186
}
193187
}

0 commit comments

Comments
 (0)