Skip to content

Commit 53c692a

Browse files
author
Garth Smedley
committed
using the same check for an empty cache as used in the retrieve() method.
1 parent 30ae1f7 commit 53c692a

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

nativescript-angular/router/ns-route-reuse-strategy.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,8 @@ export class NSRouteReuseStrategy implements RouteReuseStrategy {
7979

8080
const key = getSnapshotKey(route);
8181
const isBack = this.location._isPageNavigatingBack();
82-
const shouldAttach = isBack && this.cache.peek().key === key;
82+
const cachedItem = this.cache.peek();
83+
const shouldAttach = isBack && cachedItem && cachedItem.key === key;
8384

8485
log(`shouldAttach isBack: ${isBack} key: ${key} result: ${shouldAttach}`);
8586

0 commit comments

Comments
 (0)