Skip to content

fix: look for correct outlet to back to #58

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 18, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export class Outlet {
isNSEmptyOutlet: boolean;

// Used in reuse-strategy by its children to determine if they should be detached too.
shouldDetach: boolean = true;
shouldDetach = true;
constructor(outletKey: string, path: string, pathByOutlets: string, modalNavigationDepth?: number) {
this.outletKeys = [outletKey];
this.isPageNavigationBack = false;
Expand Down
13 changes: 11 additions & 2 deletions packages/angular/src/lib/legacy/router/page-router-outlet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -327,8 +327,17 @@ export class PageRouterOutlet implements OnDestroy {
// Add it to the new page
this.viewUtil.appendChild(page, componentView);

const topActivatedRoute = findTopActivatedRouteNodeForOutlet(this._activatedRoute.snapshot);
const outletKey = this.locationStrategy.getRouteFullPath(topActivatedRoute);
let topActivatedRoute = findTopActivatedRouteNodeForOutlet(this._activatedRoute.snapshot);
let outletKey = this.locationStrategy.getRouteFullPath(topActivatedRoute);
const thisRouteKey = outletKey;
while (!this.locationStrategy.findOutlet(outletKey)) {
topActivatedRoute = topActivatedRoute.parent;
if (!topActivatedRoute) {
NativeScriptDebug.routerError('Could not find outlet for route: ' + thisRouteKey);
break;
}
outletKey = this.locationStrategy.getRouteFullPath(topActivatedRoute);
}

const navigatedFromCallback = (<any>global).Zone.current.wrap((args: NavigatedData) => {
if (args.isBackNavigation) {
Expand Down