diff --git a/packages/angular/src/lib/legacy/router/page-router-outlet.ts b/packages/angular/src/lib/legacy/router/page-router-outlet.ts index a690d57..94e675e 100644 --- a/packages/angular/src/lib/legacy/router/page-router-outlet.ts +++ b/packages/angular/src/lib/legacy/router/page-router-outlet.ts @@ -148,9 +148,14 @@ export class PageRouterOutlet implements OnDestroy { } ngOnDestroy(): void { - // Clear accumulated modal view page cache when page-router-outlet - // destroyed on modal view closing - this.parentContexts.onChildOutletDestroyed(this.name); + // In the event that the `parentContexts` has changed the outlet + // via the creation of another outlet, the `onChildOutletDestroyed` + // will be skipped + if (this.parentContexts.getContext(this.name)?.outlet === this) { + // Clear accumulated modal view page cache when page-router-outlet + // destroyed on modal view closing + this.parentContexts.onChildOutletDestroyed(this.name); + } if (this.outlet) { this.outlet.outletKeys.forEach((key) => {