NativeScript/angular

NS8.1, Angular 13 - ns-router: No outlet found relative to activated route on navigating back

boris01 opened this issue · 1 comments

Environment
Provide version numbers for the following components (information can be retrieved by running tns info in your project folder or by inspecting the package.json of the project):

  • CLI: 8.1.5
  • Cross-platform modules: 8.1.5
  • Android Runtime: 8.1.1
  • iOS Runtime: 8.1.0
  • Plugin(s): @nativescript-community/ui-material-bottomnavigationbar 6.2.5
  • NativeScript-Angular:13.0.1
  • Angular:13.1.3

Describe the bug
I get an error: "ns-router: No outlet found relative to activated route" when navigating back in nested route (one with a named outlet) .
I debug it until this function: findTopActivatedRouteNodeForOutlet in
https://github.com/NativeScript/angular/blob/main/packages/angular/src/lib/legacy/router/page-router-outlet-utils.ts

It appears that latest changes to this function affect this functionality.

export function findTopActivatedRouteNodeForOutlet(activatedRoute: ActivatedRouteSnapshot): ActivatedRouteSnapshot {
  // TODO: test this and figure it out if it's really no longer needed
  return activatedRoute;
  // let outletActivatedRoute = activatedRoute;

  // while (outletActivatedRoute.parent && outletActivatedRoute.parent.routeConfig && !outletActivatedRoute.parent.routeConfig.component) {
  //   outletActivatedRoute = outletActivatedRoute.parent;
  // }

  // return outletActivatedRoute;
}

When reverting this change back (uncomment) it is working, but reloading the whole frame.

Closing as it duplicate of #49