Skip to content
Merged
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
32 changes: 20 additions & 12 deletions packages/angular/src/lib/legacy/router/ns-location-strategy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -288,22 +288,24 @@ export class NSLocationStrategy extends LocationStrategy implements OnDestroy {
outlet.setOutletKeyNavigatingBack(outletKey);
// outlet.isPageNavigationBack = true;
// we find all the children and also set their isPageNavigationBack
this.outlets
.filter((o) => {
let parent = o.parent;
while (parent) {
if (parent === outlet) {
return true;
}
parent = parent.parent;
}
return false;
})
.forEach((o) => (o.isPageNavigationBack = true));
this.getDescendantOutlets(outlet).forEach((o) => (o.isPageNavigationBack = true));

this.currentOutlet = outlet;
}

private getDescendantOutlets(outlet: Outlet): Outlet[] {
return this.outlets.filter((o) => {
let parent = o.parent;
while (parent) {
if (parent === outlet) {
return true;
}
parent = parent.parent;
}
return false;
});
}

public _finishBackPageNavigation(frame: Frame) {
const outlet: Outlet = this.getOutletByFrame(frame);

Expand Down Expand Up @@ -366,6 +368,12 @@ export class NSLocationStrategy extends LocationStrategy implements OnDestroy {
}

this.currentOutlet = this.getOutletByFrame(frame) || this.currentOutlet;
// _beginBackPageNavigation marks every descendant outlet as going back, but only an outlet that
// is activated during that back clears its own mark. The outlets of a page lower in the back stack
// (for example the per-tab outlets of a tab page) are not activated, so they keep the mark. A later
// forward navigation into such a page then ran as a back navigation for those outlets and they
// rendered blank. A forward page navigation means no back is in progress below this outlet.
this.getDescendantOutlets(this.currentOutlet).forEach((o) => o._navigatingBackOutlets.clear());
const lastState = this.currentOutlet.peekState();

if (lastState) {
Expand Down
Loading