From 5ce9b35912ac0f195d6401a15a9ce32b29220837 Mon Sep 17 00:00:00 2001 From: Liam DeBeasi Date: Tue, 14 Nov 2023 15:38:20 -0500 Subject: [PATCH] fix(angular): transition plays when using browser buttons Co-authored-by: hoi4 --- packages/angular/common/src/providers/nav-controller.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/angular/common/src/providers/nav-controller.ts b/packages/angular/common/src/providers/nav-controller.ts index aff31b090b3..1ae3a0a603f 100644 --- a/packages/angular/common/src/providers/nav-controller.ts +++ b/packages/angular/common/src/providers/nav-controller.ts @@ -37,9 +37,9 @@ export class NavController { if (router) { router.events.subscribe((ev) => { if (ev instanceof NavigationStart) { + // restoredState is set if the browser back/forward button is used const id = ev.restoredState ? ev.restoredState.navigationId : ev.id; - this.guessDirection = id < this.lastNavId ? 'back' : 'forward'; - this.guessAnimation = !ev.restoredState ? this.guessDirection : undefined; + this.guessDirection = this.guessAnimation = id < this.lastNavId ? 'back' : 'forward'; this.lastNavId = this.guessDirection === 'forward' ? ev.id : id; } });