Currently not in page back navigation error


#1

Hello,

When I update nativescript-angular in package.json from 3 to 4.4.1, I have got a new error “Currently not in page back navigation”. I don’t understand this error and how to fix it.

Do someone have an idea?

thanks!
serge


#2

I just find the issue: was related to a custom RouteReuseStrategy


#3

I’m reopening this topic beause I can’t find how to solve my problem:

I have an app with a special behavior and I need to never reuse a compoent so I have a CustomReuseStrategy file looking like this:

export class CustomReuseStrategy implements RouteReuseStrategy {
    shouldDetach(route: ActivatedRouteSnapshot): boolean {
        return false;
    }
    store(route: ActivatedRouteSnapshot, handle: DetachedRouteHandle): void {
    }
    shouldAttach(route: ActivatedRouteSnapshot): boolean {
        return false;
    }
    retrieve(route: ActivatedRouteSnapshot): DetachedRouteHandle {
        return null;
    }
    shouldReuseRoute(future: ActivatedRouteSnapshot, curr: ActivatedRouteSnapshot): boolean {
        return false;
    }
}

When I upgrade nativescript-angular from 3 to 4.4.1 I have got this error:

Error: Currently not in page back navigation - component should be detached instead of deactivated.

I worked on this for a few days without finding a solution. My question is simple: How to skeep the new reuse strategy system and never reuse any component for any route?

Thanks !
Serge


#4

got this awser on github: