From 46175b7cffb90f6b82951ef3e53f4423823fef88 Mon Sep 17 00:00:00 2001 From: Miguel Cabrerizo <30386061+doncicuto@users.noreply.github.com> Date: Mon, 8 Jan 2024 15:00:57 +0100 Subject: [PATCH] fix(console): keep current url after org switch (#7118) Co-authored-by: Max Peintner --- console/src/app/app.component.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/console/src/app/app.component.ts b/console/src/app/app.component.ts index 1a9ef8cd9..a8b7b2aa7 100644 --- a/console/src/app/app.component.ts +++ b/console/src/app/app.component.ts @@ -265,7 +265,12 @@ export class AppComponent implements OnDestroy { } public changedOrg(org: Org.AsObject): void { - this.router.navigate(['/org']); + // Reference: https://stackoverflow.com/a/58114797 + const currentUrl = this.router.url; + this.router.navigateByUrl('/', { skipLocationChange: true }).then(() => { + // We use navigateByUrl as our urls may have queryParams + this.router.navigateByUrl(currentUrl); + }); } private setLanguage(): void {