Navigation Menu

Skip to content

Commit

Permalink
fix(angular): do not navigate to same tab if already active (#21085)
Browse files Browse the repository at this point in the history
fixes #21074, fixes #19943
  • Loading branch information
liamdebeasi committed Apr 27, 2020
1 parent 671802f commit 15203de
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions angular/src/directives/navigation/ion-tabs.ts
Expand Up @@ -91,6 +91,12 @@ export class IonTabs {
const alreadySelected = this.outlet.getActiveStackId() === tab;
const tabRootUrl = `${this.outlet.tabsPrefix}/${tab}`;
if (alreadySelected) {
const activeStackId = this.outlet.getActiveStackId();
const activeView = this.outlet.getLastRouteView(activeStackId);

// If on root tab, do not navigate to root tab again
if (activeView.url === tabRootUrl) { return; }

const rootView = this.outlet.getRootView(tab);
const navigationExtras = rootView && tabRootUrl === rootView.url && rootView.savedExtras;
return this.navCtrl.navigateRoot(tabRootUrl, {
Expand Down

0 comments on commit 15203de

Please sign in to comment.