From b4762dc463e08d36bae53ed877dd5cbda856ae3b Mon Sep 17 00:00:00 2001 From: Thomas <4159106+dtslvr@users.noreply.github.com> Date: Sat, 22 May 2021 13:48:06 +0200 Subject: [PATCH] Bugfix/fix internal navigation with query param (#114) * Fix internal navigation with query parameter * Add guard * Update changelog --- CHANGELOG.md | 4 ++++ .../performance-chart-dialog.component.ts | 2 +- apps/client/src/app/core/auth.guard.ts | 6 +++--- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index febb5857a..45cbd6bbd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Hid footer on mobile (except on landing page) +### Fixed + +- Fixed the internal navigation of the _Zen Mode_ in combination with a query parameter + ## 1.6.0 - 22.05.2021 ### Added diff --git a/apps/client/src/app/components/performance-chart-dialog/performance-chart-dialog.component.ts b/apps/client/src/app/components/performance-chart-dialog/performance-chart-dialog.component.ts index 0a4c9e4a3..e6f3acede 100644 --- a/apps/client/src/app/components/performance-chart-dialog/performance-chart-dialog.component.ts +++ b/apps/client/src/app/components/performance-chart-dialog/performance-chart-dialog.component.ts @@ -46,7 +46,7 @@ export class PerformanceChartDialog { this.historicalDataItems = this.data.historicalDataItems; - this.historicalDataItems.forEach((historicalDataItem) => { + this.historicalDataItems?.forEach((historicalDataItem) => { const benchmarkItem = historicalData.find((item) => { return item.date === historicalDataItem.date; }); diff --git a/apps/client/src/app/core/auth.guard.ts b/apps/client/src/app/core/auth.guard.ts index 623d20c3a..d2e1fd768 100644 --- a/apps/client/src/app/core/auth.guard.ts +++ b/apps/client/src/app/core/auth.guard.ts @@ -45,12 +45,12 @@ export class AuthGuard implements CanActivate { ) .subscribe((user) => { if ( - state.url === '/home' && + state.url.startsWith('/home') && user.settings.viewMode === ViewMode.ZEN ) { this.router.navigate(['/zen']); resolve(false); - } else if (state.url === '/start') { + } else if (state.url.startsWith('/start')) { if (user.settings.viewMode === ViewMode.ZEN) { this.router.navigate(['/zen']); } else { @@ -59,7 +59,7 @@ export class AuthGuard implements CanActivate { resolve(false); } else if ( - state.url === '/zen' && + state.url.startsWith('/zen') && user.settings.viewMode === ViewMode.DEFAULT ) { this.router.navigate(['/home']);