Skip to content

Commit ea8ba37

Browse files
authored
fix: guard around empty cache (#34)
1 parent 074b589 commit ea8ba37

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

packages/angular/src/lib/legacy/router/ns-route-reuse-strategy.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ export class NSRouteReuseStrategy implements RouteReuseStrategy {
133133

134134
const key = getSnapshotKey(route);
135135
const isBack = outlet ? outlet.isPageNavigationBack : false;
136-
const shouldAttach = isBack && cache.peek().key === key;
136+
const shouldAttach = isBack && cache.peek()?.key === key;
137137

138138
if (NativeScriptDebug.isLogEnabled()) {
139139
NativeScriptDebug.routeReuseStrategyLog(`shouldAttach isBack: ${isBack} key: ${key} result: ${shouldAttach}`);

0 commit comments

Comments
 (0)