From 99c009787be3ba0b94ca66f8a2d48880c672e041 Mon Sep 17 00:00:00 2001 From: Eduardo Speroni Date: Mon, 19 Oct 2020 13:09:22 -0300 Subject: [PATCH] fix: Cannot reattach ActivatedRouteSnapshot created from a different route --- nativescript-angular/router/ns-route-reuse-strategy.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/nativescript-angular/router/ns-route-reuse-strategy.ts b/nativescript-angular/router/ns-route-reuse-strategy.ts index e05179c4e..dd966ada9 100644 --- a/nativescript-angular/router/ns-route-reuse-strategy.ts +++ b/nativescript-angular/router/ns-route-reuse-strategy.ts @@ -12,6 +12,10 @@ interface CacheItem { } const getSnapshotKey = function (snapshot: ActivatedRouteSnapshot): string { + // https://github.com/angular/angular/issues/13869#issuecomment-344403045 + while (snapshot.firstChild) { + snapshot = snapshot.firstChild; + } return snapshot.pathFromRoot.join('->'); };